window.storecrm_config = {"line":{"line_login_enable":false,"line_login_onlypreview":false},"favorite":{"button_text":"お気に入りに追加する","button_text_remove":"お気に入り済み","favoriteMode":"product","is_only_member":false},"favoriteListMode":"simple","favoriteList":{"list_title":"お気に入り一覧","loading_text":"読込中です...","non_item_text":"現在お気に入り中の商品はありません","show_cart":true,"insert_cart_directly":true},"restock":{"button_text":"再入荷通知を受け取る"},"restockPopup":{"popup_title":"再入荷通知","popup_description":"再入荷通知をご希望の方は以下から、ご選択ください。","emailaddress":"ご連絡メールアドレス","button_text":"再入荷通知を有効にする","success_text":"再入荷通知が登録されました。","error_text":"再入荷通知の登録に失敗しました。しばらくたってから再度お試しください。","error_text_email":"メールアドレスが正しくありません。確認の上、再度ご記入ください。","accepts_marketing_checkbox_text":"メルマガ配信に同意する","email_confirmation_text":"こちらのメールアドレスで間違いないですか?"},"lineRestock":{"button_text":"LINEで再入荷通知を受け取る"},"lineRestockPopup":{"title":"LINE再入荷通知","description_text":"この商品の再入荷をLINEでお知らせします","button_text":"再入荷通知を有効にする","success_text":"再入荷通知が登録されました!","error_text":"再入荷通知の登録に失敗しました。しばらくたってから再度お試しください。"},"locales":{},"backendUrl":"https://obake.groovymedia.co","appProxyName":"obake"}; (()=>{"use strict";var e={883(e,t,o){var n=o(964),i=o.n(n),r=o(941),s=o.n(r)()(i());s.push([e.id,".storecrm_modal {\n display: none;\n}\n\n.storecrm_modal.is-open {\n display: block;\n}\n\n.storecrm_modal_line {\n margin: 1rem 0;\n}\n\n.storecrm_modal_line label {\n display: flex;\n align-items: center;\n}\n\n#storecrm_restock_accepts_marketing {\n margin: 0 5px 0 0;\n max-width: 15px;\n}\n\n@media (hover: hover) {\n .storecrm_modal_line label:hover {\n cursor: pointer;\n }\n #storecrm_restock_accepts_marketing:hover {\n cursor: pointer;\n }\n}\n\n.storecrm_modal input,\n.storecrm_modal select {\n width: 100%;\n padding: 10px;\n font-size: 100%;\n margin: 1rem 0;\n}\n\n.storecrm_modal__overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 10000;\n background: rgba(0, 0, 0, 0.6);\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.storecrm_modal__container {\n background-color: #fff;\n padding: 30px;\n min-width: 320px;\n max-width: 500px;\n min-height: 200px;\n max-height: 100vh;\n border-radius: 4px;\n overflow-y: auto;\n box-sizing: border-box;\n}\n\n.storecrm_modal__header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.storecrm_modal__title {\n margin-top: 0;\n margin-bottom: 0;\n font-weight: 600;\n font-size: 1.25;\n line-height: 1.25;\n box-sizing: border-box;\n}\n\n.storecrm_modal__close {\n background: transparent;\n border: 0;\n cursor: pointer;\n}\n\n.storecrm_modal_message {\n margin-top: 2rem;\n padding: 1rem;\n}\n\n.storecrm_modal__header .storecrm_modal__close:before {\n content: '\\2715';\n}\n\n.storecrm_modal__content {\n margin-top: 2rem;\n margin-bottom: 1rem;\n line-height: 1.5;\n color: rgba(0, 0, 0, 0.8);\n}\n\n.storecrm_modal__btn {\n display: block;\n width: 100%;\n padding-top: 1rem;\n padding-bottom: 1rem;\n background-color: #e6e6e6;\n color: rgba(0, 0, 0, 0.8);\n border-radius: 0.25rem;\n border-style: none;\n border-width: 0;\n cursor: pointer;\n -webkit-appearance: button;\n text-transform: none;\n overflow: visible;\n line-height: 1.15;\n margin: 0;\n margin-top: 1rem;\n will-change: transform;\n -moz-osx-font-smoothing: grayscale;\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n transition: -webkit-transform 0.25s ease-out;\n transition: transform 0.25s ease-out;\n transition: transform 0.25s ease-out, -webkit-transform 0.25s ease-out;\n}\n\n.storecrm_modal__btn:hover {\n -webkit-transform: scale(1.05);\n transform: scale(1.05);\n}\n\n.storecrm_modal__btn-primary {\n background-color: #00449e;\n color: #fff;\n}\n\n.storecrm_modal__btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.storecrm-restock-registered {\n pointer-events: none;\n}\n\n.storecrm_login_required_modal .storecrm_modal__overlay {\n background: rgba(0, 0, 0, 0.55);\n padding: 16px;\n box-sizing: border-box;\n}\n\n.storecrm_login_required_modal .storecrm_modal__container {\n width: min(576px, 100%);\n min-width: 0;\n min-height: 0;\n max-height: calc(100vh - 32px);\n padding: 20px 16px 16px;\n border-radius: 2px;\n}\n\n.storecrm_login_required_modal .storecrm_modal__title {\n font-size: 20px;\n line-height: 1.4;\n font-weight: 600;\n}\n\n.storecrm_login_required_modal .storecrm_modal__content {\n margin-top: 14px;\n margin-bottom: 0;\n color: #111;\n font-size: 16px;\n line-height: 1.65;\n}\n\n.storecrm_login_required_actions {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 16px;\n margin-top: 28px;\n}\n\n.storecrm_login_required_login,\n.storecrm_login_required_cancel {\n min-height: 52px;\n padding: 0 16px;\n border-radius: 32px;\n font-size: 16px;\n font-weight: 600;\n line-height: 1.2;\n cursor: pointer;\n appearance: none;\n}\n\n.storecrm_login_required_login {\n color: #fff;\n background: #000;\n border: 1px solid #000;\n}\n\n.storecrm_login_required_cancel {\n color: #111;\n background: #fff;\n border: 1px solid #111;\n}\n\n@media (max-width: 480px) {\n .storecrm_login_required_actions {\n grid-template-columns: 1fr;\n gap: 12px;\n }\n}\n\n@keyframes mmfadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes mmfadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n@keyframes mmslideIn {\n from {\n transform: translateY(15%);\n }\n to {\n transform: translateY(0);\n }\n}\n\n@keyframes mmslideOut {\n from {\n transform: translateY(0);\n }\n to {\n transform: translateY(-10%);\n }\n}\n\n.micromodal-slide {\n display: none;\n}\n\n.micromodal-slide.is-open {\n display: block;\n}\n\n.micromodal-slide[aria-hidden='false'] .storecrm_modal__overlay {\n animation: mmfadeIn 0.3s cubic-bezier(0, 0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden='false'] .storecrm_modal__container {\n animation: mmslideIn 0.3s cubic-bezier(0, 0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden='true'] .storecrm_modal__overlay {\n animation: mmfadeOut 0.3s cubic-bezier(0, 0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden='true'] .storecrm_modal__container {\n animation: mmslideOut 0.3s cubic-bezier(0, 0, 0.2, 1);\n}\n\n.micromodal-slide .storecrm_modal__container,\n.micromodal-slide .storecrm_modal__overlay {\n will-change: transform;\n}\n\n/* \u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u30fb\u30d5\u30a7\u30fc\u30c9\u30a2\u30a6\u30c8\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u7528\u306e\u30af\u30e9\u30b9 */\n.fade-out {\n animation: mmfadeOut 0.3s cubic-bezier(0, 0, 0.2, 1) forwards;\n}\n\n.fade-in {\n animation: mmfadeIn 0.3s cubic-bezier(0, 0, 0.2, 1) forwards;\n}\n\n.storecrm-status-widget {\n width: 100%;\n border: 1px solid #e6e6e6;\n display: flex;\n align-items: center;\n justify-content: center;\n max-height: 3em;\n}\n\n.storecrm-status-widget > div {\n padding: 1rem;\n}\n\n@media (max-width: 767px) {\n .storecrm-status-widget {\n flex-direction: column;\n max-height: none; /* Remove height restriction */\n }\n}\n\n.storecrm-status-widget button {\n margin-left: 0.5rem;\n}\n\n.storecrm-on {\n /* deep green, bold */\n color: #094c00;\n font-weight: bold;\n}\n\n.storecrm-off {\n color: #df8536c6;\n font-weight: bold;\n}\n\n.line-chat-preview {\n display: flex;\n flex-direction: column;\n width: 360px;\n height: 640px;\n border: 1px solid #ddd;\n overflow: hidden;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);\n background-color: #92aad4;\n}\n\n.line-chat-header {\n display: flex;\n align-items: center;\n padding: 10px 16px;\n background-color: #44556f;\n color: white;\n height: 50px;\n}\n\n.line-chat-body {\n flex-grow: 1;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n gap: 8px;\n position: relative;\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n.line-chat-body::-webkit-scrollbar {\n display: none;\n}\n\n.line-chat-footer {\n padding: 0 16px 0 16px;\n background-color: #ffffff;\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 50px;\n}\n\n.line-chat-keyboard-icon {\n width: 22px;\n height: 22px;\n}\n\n.line-chat-chatbarText {\n flex-grow: 1;\n font-size: 14px;\n color: #000;\n text-align: center;\n}\n\n/* \u30ea\u30c3\u30c1\u30e1\u30cb\u30e5\u30fc\u8868\u793a\u6642\u306e\u30b9\u30bf\u30a4\u30eb */\n.line-chat-footer.menu-open .line-chat-chatbarText:after {\n content: '\u25bc';\n}\n\n/* \u30ea\u30c3\u30c1\u30e1\u30cb\u30e5\u30fc\u975e\u8868\u793a\u6642\u306e\u30b9\u30bf\u30a4\u30eb */\n.line-chat-footer:not(.menu-open) .line-chat-chatbarText:after {\n content: '\u25b2';\n}\n\n.line-richmenu-preview {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: #ffffff;\n transform: translateY(100%);\n transition: transform 0.3s cubic-bezier(0, 0, 0.2, 1);\n z-index: 10;\n box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);\n}\n\n.line-richmenu-preview.menu-open {\n transform: translateY(0);\n}\n\n.line-richmenu-preview.menu-closed {\n transform: translateY(100%);\n}\n\n/* LINE\u518d\u5165\u8377\u901a\u77e5\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u7528\u306e\u30b9\u30bf\u30a4\u30eb */\n.storecrm-line-restock-popup-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 10000;\n background: rgba(0, 0, 0, 0.6);\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n animation: mmfadeIn 0.3s cubic-bezier(0, 0, 0.2, 1) forwards;\n}\n\n.storecrm-line-restock-popup {\n background-color: #fff;\n padding: 30px;\n min-width: 320px;\n max-width: 500px;\n min-height: 150px;\n max-height: 100vh;\n border-radius: 8px;\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n box-sizing: border-box;\n text-align: center;\n overflow-y: auto;\n transform: translateY(15%);\n animation: mmslideIn 0.3s cubic-bezier(0, 0, 0.2, 1) forwards;\n will-change: transform;\n}\n\n.storecrm-line-restock-popup-text {\n font-size: 16px;\n line-height: 1.5;\n margin-bottom: 20px;\n color: rgba(0, 0, 0, 0.8);\n font-weight: 500;\n}\n\n.storecrm-line-restock-popup-button {\n display: block;\n width: 100%;\n padding: 12px 16px;\n background-color: #3b82f6;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 600;\n will-change: transform;\n backface-visibility: hidden;\n transform: translateZ(0);\n transition: transform 0.25s ease-out, background-color 0.2s ease;\n}\n\n.storecrm-line-restock-popup-button:hover {\n background-color: #2563eb;\n transform: scale(1.02);\n}\n\n.storecrm-line-restock-popup-button:active {\n transform: scale(0.98);\n}\n\n.storecrm-line-restock-popup-button:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n transform: none;\n}\n\n/* \u9589\u3058\u308b\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u7528\u306e\u30af\u30e9\u30b9 */\n.storecrm-line-restock-popup-overlay.fade-out {\n animation: mmfadeOut 0.3s cubic-bezier(0, 0, 0.2, 1) forwards;\n}\n\n.storecrm-line-restock-popup-overlay.fade-out .storecrm-line-restock-popup {\n animation: mmslideOut 0.3s cubic-bezier(0, 0, 0.2, 1) forwards;\n}\n\n/* \u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u5b9a\u7fa9 */\n@keyframes mmfadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes mmfadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n@keyframes mmslideIn {\n from {\n transform: translateY(15%);\n }\n to {\n transform: translateY(0);\n }\n}\n\n@keyframes mmslideOut {\n from {\n transform: translateY(0);\n }\n to {\n transform: translateY(-10%);\n }\n}\n\n/* \u30ec\u30b9\u30dd\u30f3\u30b7\u30d6\u5bfe\u5fdc */\n@media (max-width: 480px) {\n .storecrm-line-restock-popup {\n min-width: 280px;\n max-width: 90vw;\n padding: 20px;\n margin: 0 15px;\n }\n\n .storecrm-line-restock-popup-text {\n font-size: 14px;\n margin-bottom: 15px;\n }\n\n .storecrm-line-restock-popup-button {\n padding: 10px 14px;\n font-size: 13px;\n }\n}\n",""]);const a=s;o.d(t,["A",0,a])},941(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var o="",n=void 0!==t[5];return t[4]&&(o+="@supports (".concat(t[4],") {")),t[2]&&(o+="@media ".concat(t[2]," {")),n&&(o+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),o+=e(t),n&&(o+="}"),t[2]&&(o+="}"),t[4]&&(o+="}"),o}).join("")},t.i=function(e,o,n,i,r){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(n)for(var a=0;a0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=r),o&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=o):d[2]=o),i&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=i):d[4]="".concat(i)),t.push(d))}},t}},964(e){e.exports=function(e){return e[1]}},132(e,t,o){function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);oa});var a=function(){var e=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'],t={openTrigger:"data-micromodal-trigger",identifier:"data-micromodal-id"},o={},n=[],s=0;t.generateId=function(){return"micromodal-".concat(++s)};var a=function(){function t(e){var o=e.targetModal,n=e.triggers,i=void 0===n?[]:n,r=e.onShow,s=void 0===r?function(){}:r,a=e.onClose,l=void 0===a?function(){}:a,c=e.openTrigger,d=void 0===c?"data-micromodal-trigger":c,h=e.closeTrigger,m=void 0===h?"data-micromodal-close":h,p=e.openClass,g=void 0===p?"is-open":p,f=e.disableScroll,_=void 0!==f&&f,v=e.disableFocus,b=void 0!==v&&v,y=e.awaitCloseAnimation,k=void 0!==y&&y,w=e.awaitOpenAnimation,x=void 0!==w&&w,S=e.debugMode,R=void 0!==S&&S;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.modal="string"==typeof o?document.getElementById(o):o,this.modalId=null,null!==this.modal?(this.config={debugMode:R,disableScroll:_,openTrigger:d,closeTrigger:m,openClass:g,onShow:s,onClose:l,awaitCloseAnimation:k,awaitOpenAnimation:x,disableFocus:b},this.showModal=this.showModal.bind(this),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this),this.setFocusToFirstNode=this.setFocusToFirstNode.bind(this),this.triggers=i,this.registerTriggers()):!0===R&&u(o,R,!1)}var o,s;return o=t,s=[{key:"registerTriggers",value:function(){var e=this;this.triggers.filter(Boolean).forEach(function(t){t.addEventListener("click",e.showModal)})}},{key:"unregisterTriggers",value:function(){var e=this;this.triggers.filter(Boolean).forEach(function(t){t.removeEventListener("click",e.showModal)})}},{key:"destroy",value:function(){this.closeModal(),this.unregisterTriggers()}},{key:"showModal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.modal.classList.contains(this.config.openClass)||(this.removeEventListeners(),this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(this.config.openClass),this.toggleScrolling(!1),this.addEventListeners(),this.modalId&&-1===n.indexOf(this.modalId)&&n.push(this.modalId),this.config.awaitOpenAnimation?this.modal.addEventListener("animationend",this.setFocusToFirstNode,{once:!0}):this.setFocusToFirstNode(),this.config.onShow(this.modal,this.activeElement,e))}},{key:"closeModal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this.modal,o=this.config.openClass;if(t.classList.contains(o)){var i=n.indexOf(this.modalId);i>-1&&n.splice(i,1),this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.toggleScrolling(!0),this.activeElement&&this.activeElement.focus&&this.activeElement.focus(),this.config.onClose(this.modal,this.activeElement,e),this.config.awaitCloseAnimation?this.modal.addEventListener("animationend",function(){t.classList.remove(o)},{once:!0}):t.classList.remove(o)}}},{key:"toggleScrolling",value:function(e){if(this.config.disableScroll){var t=!e||n.length>0;document.body.style.overflow=t?"hidden":"",document.body.style.touchAction=t?"none":""}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("click",this.onClick),this.modal.addEventListener("keydown",this.onKeydown),this.modalId?0===n.length&&document.addEventListener("keydown",c):document.removeEventListener("keydown",c)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("click",this.onClick),this.modal.removeEventListener("keydown",this.onKeydown),0===n.length&&document.removeEventListener("keydown",c)}},{key:"onClick",value:function(e){var t=d(e.target,this.modal),o=e.target.closest("[".concat(this.config.closeTrigger,"]"));(e.target.hasAttribute(this.config.closeTrigger)&&t||null!==o&&!d(o,this.modal)&&!t)&&(e.preventDefault(),e.stopPropagation(),this.closeModal(e))}},{key:"onKeydown",value:function(e){"Escape"!==e.key&&27!==e.keyCode||null!==this.modal.querySelector('[role="alertdialog"]')||this.closeModal(e),"Tab"!==e.key&&9!==e.keyCode||this.retainFocus(e,"inside")}},{key:"getFocusableNodes",value:function(){return r(this.modal.querySelectorAll(e))}},{key:"setFocusToFirstNode",value:function(){var e=this;if(!this.config.disableFocus){var t=this.getFocusableNodes();if(0!==t.length){var o=t.filter(function(t){return!t.hasAttribute(e.config.closeTrigger)});o.length>0&&o[0].focus(),0===o.length&&t[0].focus()}}}},{key:"retainFocus",value:function(e,t){var o=this.getFocusableNodes();if(0!==o.length)if(o=o.filter(function(e){return null!==e.offsetParent}),"outside"===t)o[0].focus(),e.preventDefault();else{var n=o.indexOf(document.activeElement);e.shiftKey&&0===n&&(o[o.length-1].focus(),e.preventDefault()),!e.shiftKey&&o.length>0&&n===o.length-1&&(o[0].focus(),e.preventDefault())}}}],s&&i(o.prototype,s),Object.defineProperty(o,"prototype",{writable:!1}),t}(),l=function(e){if("string"==typeof e)return e;if(e instanceof HTMLElement){var o=e.getAttribute(t.identifier);return o||(e.id?e.id:(o=t.generateId(),e.setAttribute(t.identifier,o),o))}return null},c=function(e){var t=o[n[n.length-1]];t.modal.contains(document.activeElement)||("Escape"!==e.key&&27!==e.keyCode||null!==t.modal.querySelector('[role="alertdialog"]')||p(),"Tab"!==e.key&&9!==e.keyCode||t.retainFocus(e,"outside"))},d=function(e,t){return e===t||e.parentNode===t},u=function(e,t){return!!(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?void 0!==o[e]:"string"==typeof e?null!==document.getElementById(e):e instanceof HTMLElement)||(t&&console.warn("MicroModal: \u2757Seems like you have missed %c'".concat(e,"'%c ID somewhere in your code. Try the example below to resolve it.\n\n")+'%cExample:%c '),"background-color: #f8f9fa;color: #50596c;font-weight: bold;","","background-color: #f8f9fa;color: #50596c;font-weight: bold;",""),!1)},h=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Object.assign({},t,{targetModal:e},n),r=l(e);u(i.targetModal,i.debugMode,!1)&&(o[r]||(o[r]=new a(i),o[r].modal.setAttribute(t.identifier,r),o[r].modalId=r))},m=function(e,n){var i=l(e);u(i,t.debugMode)&&Object.assign(o[i].config,n)},p=function(e){if(0!==n.length)if(e){var t=l(e);n.indexOf(t)>-1&&o[t].closeModal()}else o[n[n.length-1]].closeModal()};return{init:function(e){Object.assign(t,e);var o=r(document.querySelectorAll("[".concat(t.openTrigger,"]"))),n=function(e,t){var o=[];return e.forEach(function(e){var n=e.getAttribute(t);o[n]||(o[n]=[]),o[n].push(e)}),o}(o,t.openTrigger);!0===t.debugMode&&!1===function(e){return!(e.length<=0&&(console.warn('MicroModal: \u2757Please specify at least one %c\'micromodal-trigger\'%c data attribute.\n\n%cExample:%c Open modal',"background-color: #f8f9fa;color: #50596c;font-weight: bold;","","background-color: #f8f9fa;color: #50596c;font-weight: bold;",""),1))}(o)||Object.keys(n).forEach(function(e){var t=n[e];h(e,{targetModal:e,triggers:t})})},initModal:h,config:m,show:function(e,t){var n=l(e);o[n]?t&&m(e,t):h(n,t),o[n]&&o[n].showModal()},close:p,closeAll:function(){for(var e=n.length-1;e>=0;e--)o[n[e]].closeModal()},removeModal:function(e){var t=l(e),n=o[t];n&&(n.destroy(),delete o[t])}}}();"undefined"!=typeof window&&(window.MicroModal=a)},389(e,t,o){o.r(t);var n=o(263),i=o.n(n),r=o(196),s=o.n(r),a=o(912),l=o.n(a),c=o(375),d=o.n(c),u=o(403),h=o.n(u),m=o(752),p=o.n(m),g=o(883),f={};f.styleTagTransform=p(),f.setAttributes=d(),f.insert=l().bind(null,"head"),f.domAPI=s(),f.insertStyleElement=h();i()(g.A,f);const _=g.A&&g.A.locals?g.A.locals:void 0;o.d(t,["default",0,_])},263(e){var t=[];function o(e){for(var o=-1,n=0;n0?" ".concat(o.layer):""," {")),n+=o.css,i&&(n+="}"),o.media&&(n+="}"),o.supports&&(n+="}");var r=o.sourceMap;r&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),t.styleTagTransform(n,e,t.options)}(t,e,o)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},752(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},332(e,t){t.schema=t.iF=t.XX=void 0;t.XX=(e,t)=>{const o="ja"===t,n=o?{available:"\u5728\u5eab\u3042\u308a",unavailable:"\u5728\u5eab\u5207\u308c",cart:"\u30ab\u30fc\u30c8\u306b\u8ffd\u52a0",product:"\u5546\u54c1\u3092\u898b\u308b",remove:"\u524a\u9664",noImage:"\u753b\u50cf\u306a\u3057"}:{available:"In stock",unavailable:"Out of stock",cart:"Add to cart",product:"View product",remove:"Remove",noImage:"No image"};return(o?[{title:"\u30aa\u30fc\u30ac\u30cb\u30c3\u30af\u30b3\u30c3\u30c8\u30f3 \u30ea\u30e9\u30c3\u30af\u30b9\u30b7\u30e3\u30c4",available:!0,imageUrl:"https://placehold.jp/320x240.png?text=StoreCRM"},{title:"\u6bce\u65e5\u4f7f\u3048\u308b\u8efd\u91cf\u30ad\u30e3\u30f3\u30d0\u30b9\u30c8\u30fc\u30c8",available:!1},{title:"\u5b63\u7bc0\u9650\u5b9a\u30ab\u30e9\u30fc\u306e\u30bd\u30d5\u30c8\u30cb\u30c3\u30c8",available:!0,imageUrl:"https://placehold.jp/320x240.png?text=Favorite"}]:[{title:"Organic cotton relaxed shirt",available:!0,imageUrl:"https://placehold.jp/320x240.png?text=StoreCRM"},{title:"Lightweight everyday canvas tote",available:!1},{title:"Seasonal color soft knit",available:!0,imageUrl:"https://placehold.jp/320x240.png?text=Favorite"}]).map(t=>((e,t,o)=>{const n="product_link"===e.cart_icon?o.product:o.cart,i=t.available?"is-available":"is-unavailable";return`\n \n \n
\n \n ${t.imageUrl?`${t.title}`:`${o.noImage}`}\n \n
\n ${t.title}\n ${!1!==e.show_stock_status?`\n ${t.available?o.available:o.unavailable}\n `:""}\n
\n
\n \n \n \n \n `;var r})(e,t,n)).join("")};t.iF=e=>'\n \n',t.schema={preview:(e,o)=>{let n=`
`;return n+=(0,t.iF)(e),n+=`

${e.list_title}

`,n+=`${e.loading_text}`,n+=`${e.non_item_text}`,n+="",n+="",n+=(0,t.XX)(e,o),n+="",n+="
",n+="
",n},rows:[{type:"select",slug:"layout_preset",nameJa:"\u4e00\u89a7\u30c7\u30b6\u30a4\u30f3",nameEn:"List design",default:"standard",selectOptionsJa:[{value:"standard",label:"\u6a19\u6e96\u8868\u793a"},{value:"card",label:"\u30ab\u30fc\u30c9\u8868\u793a"},{value:"horizontal",label:"\u30eb\u30c3\u30af\u30d6\u30c3\u30af\u8868\u793a"},{value:"detailed",label:"\u8a73\u7d30\u30ea\u30b9\u30c8\u8868\u793a"}],selectOptionsEn:[{value:"standard",label:"Standard"},{value:"card",label:"Cards"},{value:"horizontal",label:"Lookbook"},{value:"detailed",label:"Detailed list"}]},{type:"text",slug:"list_title",nameJa:"\u30bf\u30a4\u30c8\u30eb",nameEn:"title",defaultJa:"\u304a\u6c17\u306b\u5165\u308a\u4e00\u89a7",defaultEn:"Your favorites"},{type:"text",slug:"loading_text",nameJa:"\u8aad\u307f\u8fbc\u307f\u4e2d\u306b\u8868\u793a\u3059\u308b\u30c6\u30ad\u30b9\u30c8",nameEn:"loading text",defaultJa:"\u8aad\u8fbc\u4e2d\u3067\u3059...",defaultEn:"Loading..."},{type:"text",slug:"non_item_text",nameJa:"\u304a\u6c17\u306b\u5165\u308a\u767b\u9332\u304c\u306a\u3044\u5834\u5408\u306b\u8868\u793a\u3059\u308b\u30c6\u30ad\u30b9\u30c8",nameEn:"non item text",defaultJa:"\u73fe\u5728\u304a\u6c17\u306b\u5165\u308a\u4e2d\u306e\u5546\u54c1\u306f\u3042\u308a\u307e\u305b\u3093",defaultEn:"There are currently no favorited items."},{type:"checkbox",slug:"show_stock_status",nameJa:"\u5728\u5eab\u72b6\u6cc1\u3092\u8868\u793a\u3059\u308b",nameEn:"show stock status",descriptionJa:"\u30ab\u30fc\u30c9\u30fb\u30eb\u30c3\u30af\u30d6\u30c3\u30af\u30fb\u8a73\u7d30\u30ea\u30b9\u30c8\u306b\u300c\u5728\u5eab\u3042\u308a\uff0f\u5728\u5eab\u5207\u308c\u300d\u3092\u8868\u793a\u3057\u307e\u3059",descriptionEn:"Shows \u201cIn stock / Out of stock\u201d in cards, lookbook, and detailed list layouts",default:!0},{type:"checkbox",slug:"show_cart",nameJa:"\u30ab\u30fc\u30c8\u30dc\u30bf\u30f3\u3092\u8868\u793a\u3059\u308b",nameEn:"show cart button",default:!0},{type:"select",slug:"cart_icon",nameJa:"\u30ab\u30fc\u30c8\u30dc\u30bf\u30f3\u306e\u30a2\u30a4\u30b3\u30f3",nameEn:"cart button icon",default:"cart",depends:"show_cart",selectOptionsJa:[{value:"cart",label:"\u30ab\u30fc\u30c8"},{value:"cart_plus",label:"\u30ab\u30fc\u30c8 +"},{value:"bag",label:"\u30d0\u30c3\u30b0"},{value:"product_link",label:"\u5546\u54c1\u30da\u30fc\u30b8\u3078\u79fb\u52d5"}],selectOptionsEn:[{value:"cart",label:"Cart"},{value:"cart_plus",label:"Cart +"},{value:"bag",label:"Bag"},{value:"product_link",label:"Go to product page"}]},{type:"checkbox",slug:"insert_cart_directly",nameJa:"\u30ab\u30fc\u30c8\u30dc\u30bf\u30f3\u3067\u76f4\u63a5\u30ab\u30fc\u30c8\u306b\u5165\u308c\u308b",nameEn:"insert cart directly",default:!0,descriptionJa:"\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u30e2\u30fc\u30c9\u306e\u5834\u5408\u306e\u307f\u6709\u52b9\u3067\u3059\u3002\u30ab\u30fc\u30c8\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068\u3001\u81ea\u52d5\u3067\u30ab\u30fc\u30c8\u306b\u5165\u308a\u3001\u30ab\u30fc\u30c8\u30da\u30fc\u30b8\u306b\u9077\u79fb\u3057\u307e\u3059\u3002",descriptionEn:"Only for variation mode. When you press the cart button, it will automatically be added to the cart and transition to the cart page."}]}},475(e,t,o){t.schema=t.renderWidgetSelector=t.hideWidgetSelector=t.render=t.s=void 0;const n=o(811);t.s=(e,t=!1)=>{let o=null;return"star"===e.buttonicon?o=t?'':'':"heart"===e.buttonicon?o=t?'':'':"tag"===e.buttonicon?o='':"clip"===e.buttonicon&&(o=''),o&&(o=o.replace("viewBox",`width="${e.icon_size}" height="${e.icon_size}" style="margin-right: ${e.icon_margin}px;" viewBox`)),o};class i{constructor(e,t,o,n,i,r=!1,s=!1,a){this.eventTriggered=!1,this.variants=o,this.buttonSettings=Object.assign({},n),this.productId=t,this.button=i,this.isFavorited=r,this.hasVariantSelector=s,this.variantId=a,this.buttonSettings.has_background||(this.buttonSettings.button_width="auto",this.buttonSettings.button_height="auto",this.buttonSettings.button_radius=0,this.buttonSettings.button_border_width=0,this.buttonSettings.button_background_color="transparent",this.buttonSettings.button_border_color="transparent",this.buttonSettings.button_hover_border_color="transparent",this.buttonSettings.button_hover_background_color="transparent")}static getInstance(e,t,o,n,r,s=!1,a=!1,l){if(i.instances[e]){const c=i.instances[e];c.isFavorited=s,c.hasVariantSelector=a,c.buttonSettings=Object.assign({},n),c.variants=o,c.button=r,c.productId=t,c.variantId=l}else i.instances[e]=new i(e,t,o,n,r,s,a,l);return i.instances[e]}checkRender(e){document.querySelectorAll(`.storecrm-wishlistbutton-${e}`).forEach(e=>{if(e instanceof HTMLElement&&e.closest('[data-type="wishlist-button"]')){const t=new URL(location.href),o=t.searchParams.get("variant")&&t.searchParams.get("variant")||"";o&&(e.dataset.variantId=o),window.storecrm&&window.storecrm.render(!0)}})}render(e,o=!1){const n=(0,t.s)(this.buttonSettings,this.isFavorited),i=new URL(location.href),r=parseInt(i.searchParams.get("variant")||this.variantId||"0",10)||"",s=this.hasVariantSelector?"data-variant-selector":"",a=void 0!==this.button.dataset.noLabel;if(!this.eventTriggered)if(window.navigation)window.navigation.addEventListener("navigate",()=>{window.setTimeout(()=>this.checkRender(e),100)}),window.setTimeout(()=>this.checkRender(e),100),window.setTimeout(()=>this.checkRender(e),1e3);else{let t=location.href;window.setInterval(()=>{t!==location.href&&(t=location.href,this.checkRender(e))},1e3),window.setTimeout(()=>this.checkRender(e),100),window.setTimeout(()=>this.checkRender(e),1e3)}this.eventTriggered;this.eventTriggered=!0;const l=o?"":`onclick="event.preventDefault();window.storecrm ? window.storecrm.toggleWishlist(this, ${this.isFavorited?"true":"false"}, ${this.buttonSettings.is_only_member}, '${this.buttonSettings.non_member_link||""}') : alert('\u8aad\u8fbc\u4e2d\u3067\u3059\u3002\u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002');"`,c=``,d=document.querySelector("#storecrm-wishlistbutton-style");return o?(d&&d.remove(),document.body.insertAdjacentHTML("afterend",c)):d||document.body.insertAdjacentHTML("afterend",c),`
\n\n
`}}i.instances={};let r,s,a;t.render=({productId:e,variantId:t,id:o,variants:n,product:r,button:s,buttonSettings:a,isFavorited:l=!1,preview:c=!1,hasVariantSelector:d=!1})=>i.getInstance(o,e,n,a,s,l,d,t).render(o,c);t.hideWidgetSelector=()=>{r&&(r.remove(),r=void 0),document.querySelectorAll(".storecrm-variantselector-dropdown").forEach(e=>e.remove()),s=void 0,a=void 0};t.renderWidgetSelector=({button:e,productId:o,variants:i,wishlist:l,buttonSettings:c,preview:d=!1,rerender:u=!1})=>{const h=Array.isArray(null==l?void 0:l.variants)?l.variants:[];l.variants=h;const m=s===o&&a?a:i,p=r&&u&&s==o?r.style:void 0;let g=0;if(!d&&r&&u&&(g=r.scrollTop),!d&&u&&s!==o)return;if(!d&&r&&(r.remove(),r=void 0,!u))return;s=o,a=m;const f=m.map(e=>{const i=(0,n.containsShopifyId)(h,e.id),r=(0,t.s)(c,i),s=d?"":`onclick="event.preventDefault();event.stopPropagation();window.storecrm ? window.storecrm.toggleWishlist(this, ${i?"true":"false"}, ${c.is_only_member}, '${c.non_member_link||""}') : alert('\u8aad\u8fbc\u4e2d\u3067\u3059\u3002\u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002');"`;return`\n ${r||(i?c.button_text_remove:c.button_text)}\n ${e.title}\n `}).join("");let _="";if(d)_="position: static;";else if(p)_=`top: ${p.top}; left: ${p.left};`;else{const t=e.getBoundingClientRect(),o=250;let n=t.left+document.documentElement.scrollLeft;n+o>window.innerWidth&&(n=window.innerWidth-o),_=`top: ${t.bottom+document.documentElement.scrollTop}px; left: ${n}px;`}const v=``;d||(document.body.insertAdjacentHTML("afterend",v),r=document.querySelector(".storecrm-variantselector-dropdown"),u&&g>0&&(r.scrollTop=g));{const e=e=>{e.target&&e.target instanceof HTMLElement&&e.target.closest("[data-variant-selector]")||r&&(r.remove(),r=void 0)};document.addEventListener("click",e),document.addEventListener("resize",e)}return v},t.schema={preview:(e,o)=>{let n=`
${"ja"===o?"\u304a\u6c17\u306b\u5165\u308a\u30dc\u30bf\u30f3(\u304a\u6c17\u306b\u5165\u308a\u524d)":"Favorite button (before it is added)"}
`;return n+=(0,t.render)({productId:"TEMP_product",id:"TEMP_favorite",buttonSettings:e,button:document.createElement("div"),isFavorited:!1,preview:!0,variants:[],product:null}),"variant"===e.favoriteMode&&(n+=`
${"ja"===o?"\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u30e2\u30fc\u30c9\u306e\u969b\u306e\u304a\u6c17\u306b\u5165\u308a\u30dc\u30bf\u30f3":"Favorite button for variant mode"}
`,n+=(0,t.renderWidgetSelector)({productId:"TEMP_product",variants:"ja"===o?[{id:"1",title:"\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f31"},{id:"2",title:"\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f32"},{id:"3",title:"\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f33"}]:[{id:"1",title:"Variant 1"},{id:"2",title:"Variant 2"},{id:"3",title:"Variant 3"}],wishlist:{products:[],variants:[]},buttonSettings:e,button:document.createElement("div"),preview:!0,rerender:!1})),n+=`
${"ja"===o?"\u304a\u6c17\u306b\u5165\u308a\u30dc\u30bf\u30f3(\u304a\u6c17\u306b\u5165\u308a\u5f8c)":"Favorite button (after it is added)"}
`,n+=(0,t.render)({productId:"TEMP_product",id:"TEMP_favorite2",buttonSettings:e,button:document.createElement("div"),isFavorited:!0,preview:!0,variants:[],product:null}),n},rows:[{type:"card",slug:"favoriteMode",nameJa:"\u304a\u6c17\u306b\u5165\u308a\u306e\u30e2\u30fc\u30c9\u3092\u9078\u3093\u3067\u304f\u3060\u3055\u3044",nameEn:"Choose the favorite mode",default:"product",selectOptionsJa:[{value:"product",label:"\u5546\u54c1\u3054\u3068\u306b\u304a\u6c17\u306b\u5165\u308a\u3092\u3059\u308b"},{value:"variant",label:"\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3(\u5546\u54c1\u306e\u8272\u3084\u30b5\u30a4\u30ba\u306a\u3069)\u3054\u3068\u306b\u304a\u6c17\u306b\u5165\u308a\u3092\u3059\u308b"}],selectOptionsEn:[{value:"product",label:"Favorite by product"},{value:"variant",label:"Favorite by variant (such as color or size)"}],warningOnChangeJa:"\u8a2d\u5b9a\u3092\u5909\u66f4\u3059\u308b\u3068\u3001\u65e2\u5b58\u306e\u304a\u6c17\u306b\u5165\u308a\u30c7\u30fc\u30bf\u304c\u7121\u52b9\u3068\u306a\u308a\u307e\u3059\u3002\u30c7\u30fc\u30bf\u79fb\u7ba1\u3092\u3054\u5e0c\u671b\u306e\u65b9\u306f\u3053\u306e\u8a2d\u5b9a\u3092\u4fdd\u5b58\u305b\u305a\u306b\u3001\u304a\u554f\u3044\u5408\u308f\u305b\u304f\u3060\u3055\u3044\u3002",warningOnChangeEn:"Changing the setting will invalidate existing favorite data. Please contact us if you wish to transfer the data.",fullsize:!0},{type:"checkbox",slug:"is_only_member",nameJa:"\u304a\u6c17\u306b\u5165\u308a\u6a5f\u80fd\u306e\u5229\u7528\u3092\u4f1a\u54e1\u9650\u5b9a\u306b\u3059\u308b",nameEn:"Enable favorite function for sign-in customers only",default:!1,fullsize:!0},{type:"text",slug:"non_member_link",nameJa:"\u30b2\u30b9\u30c8\u304c\u304a\u6c17\u306b\u5165\u308a\u3092\u62bc\u3057\u305f\u5834\u5408\u306e\u9077\u79fb\u5148URL\u3000\u203b\u7a7a\u6b04\u306e\u5834\u5408\u30ed\u30b0\u30a4\u30f3\u753b\u9762\u306b\u9077\u79fb\u3057\u307e\u3059",nameEn:"URL to redirect to when a guest clicks the favorite button. If left blank, the login screen will be displayed.",default:"",depends:"is_only_member",fullsize:!0},{type:"select",slug:"buttonicon",nameJa:"\u30a2\u30a4\u30b3\u30f3",nameEn:"buttonIcon",selectOptionsJa:[{value:"star",label:"\u661f\u30de\u30fc\u30af(\u2606)"},{value:"heart",label:"\u30cf\u30fc\u30c8\u30de\u30fc\u30af(\u2661)"},{value:"tag",label:"\u30bf\u30b0\u30a2\u30a4\u30b3\u30f3"},{value:"clip",label:"\u30af\u30ea\u30c3\u30d7\u30a2\u30a4\u30b3\u30f3"},{value:"none",label:"\u306a\u3057"}],selectOptionsEn:[{value:"star",label:"Star icon (\u2606)"},{value:"heart",label:"Heart icon (\u2661)"},{value:"tag",label:"Tag icon"},{value:"clip",label:"Clip icon"},{value:"none",label:"None"}],default:"star"},{type:"text",slug:"button_text",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"buttonText",defaultJa:"\u304a\u6c17\u306b\u5165\u308a",defaultEn:"Favorite"},{type:"text",slug:"button_text_remove",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8(\u304a\u6c17\u306b\u5165\u308a\u89e3\u9664)",nameEn:"buttonTextRemove",defaultJa:"\u304a\u6c17\u306b\u5165\u308a\u6e08\u307f",defaultEn:"Favorited"},{type:"checkbox",slug:"has_background",nameJa:"\u80cc\u666f\u304c\u3042\u308b\u30dc\u30bf\u30f3\u306b\u3059\u308b",nameEn:"hasBackground",default:!1},{type:"range",slug:"button_width",nameJa:"\u30dc\u30bf\u30f3\u306e\u5e45",nameEn:"buttonWidth",default:200,min:50,max:600,step:10,depends:"has_background"},{type:"range",slug:"button_height",nameJa:"\u30dc\u30bf\u30f3\u306e\u9ad8\u3055",nameEn:"buttonHeight",default:50,min:30,max:100,step:10,depends:"has_background"},{type:"colorpicker",slug:"button_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272",nameEn:"buttonColor",default:"#000000"},{type:"colorpicker",slug:"icon_color",nameJa:"\u30a2\u30a4\u30b3\u30f3\u306e\u6587\u5b57\u8272",nameEn:"iconColor",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"buttonBackgroundColor",default:"#ffffff",depends:"has_background"},{type:"colorpicker",slug:"button_border_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u8272",nameEn:"buttonBorderColor",default:"#000000",depends:"has_background"},{type:"colorpicker",slug:"button_hover_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"buttonHoverColor",default:"#222222"},{type:"colorpicker",slug:"icon_hover_color",nameJa:"\u30a2\u30a4\u30b3\u30f3\u306e\u6587\u5b57\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"iconHoverColor",default:"#000000"},{type:"colorpicker",slug:"button_hover_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"buttonHoverBackgroundColor",default:"#dddddd",depends:"has_background"},{type:"colorpicker",slug:"button_hover_border_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"buttonHoverBorderColor",default:"#222222",depends:"has_background"},{type:"range",slug:"button_radius",nameJa:"\u30dc\u30bf\u30f3\u306e\u4e38\u307f",nameEn:"buttonRadius",default:5,min:0,max:20,step:1,depends:"has_background"},{type:"range",slug:"button_border_width",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u592a\u3055",nameEn:"buttonBorderWidth",default:0,min:0,max:10,step:1,depends:"has_background"},{type:"fontpicker",slug:"button_font",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8",nameEn:"buttonFont",default:"helvetica_n4"},{type:"range",slug:"button_fontsize",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba",nameEn:"buttonFontSize",default:16,min:10,max:30,step:1},{type:"range",slug:"button_fontweight",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8\u30a6\u30a7\u30a4\u30c8",nameEn:"buttonFontWeight",default:400,min:100,max:900,step:100},{type:"range",slug:"icon_size",nameJa:"\u30a2\u30a4\u30b3\u30f3\u306e\u30b5\u30a4\u30ba",nameEn:"iconSize",default:16,min:10,max:30,step:1},{type:"range",slug:"icon_margin",nameJa:"\u30a2\u30a4\u30b3\u30f3\u3068\u30c6\u30ad\u30b9\u30c8\u3068\u306e\u9593\u9694",nameEn:"iconMargin",default:5,min:0,max:20,step:1},{type:"range",slug:"button_speed",nameJa:"\u30dc\u30bf\u30f3\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u901f\u5ea6",nameEn:"buttonSpeed",default:.3,min:0,max:1,step:.1},{type:"select",slug:"align",nameJa:"\u30dc\u30bf\u30f3\u306e\u914d\u7f6e",nameEn:"align",default:"center",selectOptionsJa:[{value:"left",label:"\u5de6\u5bc4\u305b"},{value:"center",label:"\u4e2d\u592e\u5bc4\u305b"},{value:"right",label:"\u53f3\u5bc4\u305b"}],selectOptionsEn:[{value:"left",label:"Align left"},{value:"center",label:"Align center"},{value:"right",label:"Align right"}]},{type:"colorpicker",slug:"popup_text_color",nameJa:"POPUP\u306e\u30c6\u30ad\u30b9\u30c8\u8272",nameEn:"popupTextColor",default:"#000000",checkVisible:e=>"variant"===e.favoriteMode},{type:"colorpicker",slug:"popup_background_color",nameJa:"POPUP\u306e\u80cc\u666f\u8272",nameEn:"popupBackgroundColor",default:"#ffffff",checkVisible:e=>"variant"===e.favoriteMode},{type:"colorpicker",slug:"popup_icon_color",nameJa:"POPUP\u306e\u30a2\u30a4\u30b3\u30f3\u8272",nameEn:"popupIconColor",default:"#000000",checkVisible:e=>"variant"===e.favoriteMode},{type:"colorpicker",slug:"popup_icon_hover_color",nameJa:"POPUP\u306e\u30a2\u30a4\u30b3\u30f3\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"popupIconHoverColor",default:"#000000",checkVisible:e=>"variant"===e.favoriteMode},{type:"range",slug:"popup_border_width",nameJa:"POPUP\u306e\u7dda\u306e\u592a\u3055",nameEn:"popupBorderWidth",default:0,min:0,max:10,step:1,checkVisible:e=>"variant"===e.favoriteMode},{type:"colorpicker",slug:"popup_border_color",nameJa:"POPUP\u306e\u7dda\u306e\u8272",nameEn:"popupBorderColor",default:"#999",checkVisible:e=>"variant"===e.favoriteMode}]}},232(e,t,o){var n=this&&this.__awaiter||function(e,t,o,n){return new(o||(o=Promise))(function(i,r){function s(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer=void 0;const i=o(805),r=o(718),s=o(250),a={layout_preset:"standard",list_title:"\u304a\u6c17\u306b\u5165\u308a\u4e00\u89a7",loading_text:"\u8aad\u8fbc\u4e2d\u3067\u3059...",non_item_text:"\u73fe\u5728\u304a\u6c17\u306b\u5165\u308a\u4e2d\u306e\u5546\u54c1\u306f\u3042\u308a\u307e\u305b\u3093",show_stock_status:!0,show_cart:!1,insert_cart_directly:!0,cart_icon:"cart"};class l{static getInstance(e){return l.instance||(l.instance=new l(e)),l.instance}constructor(e){this.config=a,this.mode="product",this.favoriteListMode="simple",this.inited=!1,this.currentIds="",this.loadingNextPage=!1,this.appendedCursors=new Set,this.advancedHandlerRoots=new WeakSet,this.loadMoreRequestSeq=0,this.parent=e}getFavoriteListRoot(){const e=document.querySelector(".storecrm_favoritelist");if(e instanceof HTMLElement)return e;const t=document.querySelector("[data-storecrm-preview-context]");return t instanceof HTMLElement?t:null}init(){return n(this,void 0,void 0,function*(){this.inited||(this.inited=!0,yield this.loadConfig())})}loadConfig(){return n(this,void 0,void 0,function*(){this.config=Object.assign(Object.assign({},a),this.parent.config.favoriteList||{});const e=new URLSearchParams(window.location.search),t=document.querySelector("[data-storecrm-preview-context]"),o="preview"===e.get("ids")&&e.get("preview_token")||void 0;this.previewToken=o||(null==t?void 0:t.dataset.storecrmPreviewToken),this.favoriteListMode=this.previewToken?"advanced":this.parent.config.favoriteListMode||"simple",this.applyConfig();const n=e.get("mode")||(null==t?void 0:t.dataset.storecrmPreviewMode);this.mode=!this.previewToken||"product"!==n&&"variant"!==n?this.parent.favoriteMode:n,console.log("StoreCRM: Favorite list renderer configured",{favoriteListMode:this.favoriteListMode,mode:this.mode,isPreview:Boolean(this.previewToken),hasPreviewContext:Boolean(t),pathname:window.location.pathname})})}applyConfig(){const e=document.getElementById("list_title"),t=document.getElementById("loading_text"),o=document.getElementById("non_item_text");e&&(e.textContent=this.config.list_title),t&&(t.textContent=this.config.loading_text),o&&(o.textContent=this.config.non_item_text);const n=this.getFavoriteListRoot();n&&("advanced"===this.favoriteListMode?(delete n.dataset.layoutPreset,n.dataset.storecrmRenderMode="advanced"):(delete n.dataset.storecrmRenderMode,n.dataset.layoutPreset=this.config.layout_preset||"standard"))}render(){return n(this,void 0,void 0,function*(){var e;const t=JSON.parse(localStorage.getItem("storecrm_wishlist")||"{}"),o=this.getWishlistIds(t),n=o.join(",");if("advanced"===this.favoriteListMode){const e=this.previewToken?"preview":n;return console.log("StoreCRM: Favorite advanced render requested",{ids:"preview"===e?"preview":`${o.length} item(s)`,isPreview:Boolean(this.previewToken)}),void(yield this.renderAdvancedPreview(e))}if(0===o.length){null===(e=document.querySelector(".storecrm_favoritelist table"))||void 0===e||e.remove();const t=document.querySelector(".storecrm_favoritelist_loading"),o=document.querySelector(".storecrm_favoritelist_non_item");return t&&(t.style.display="none"),void(o&&(o.style.display="block"))}const i=document.querySelector(".storecrm_favoritelist_loading");i&&(i.style.display="none"),yield this.loadProductAndRender(n)})}getWishlistIds(e){const t="variant"===this.mode?null==e?void 0:e.variants:null==e?void 0:e.products;return Array.isArray(t)?t:[]}buildAdvancedRenderUrl(e,t){const o=(0,i.getFavoriteListRequestedLocale)(),n=new URLSearchParams({ids:e,mode:this.mode});return o&&n.set("locale",o),t&&n.set("cursor",t),"preview"===e&&this.previewToken&&n.set("preview_token",this.previewToken),`${(0,s.buildAppProxyUrl)("/favorites/render",{origin:window.location.origin,path:this.parent.config.appProxyPath,name:this.parent.config.appProxyName})}?${n.toString()}`}extractAdvancedHtml(e){var t,o;const n=e.match(/\[liquid\]([\s\S]*?)\[\/liquid\]/m);if(n)return n[1];if(this.previewToken){const n="\x3c!--storecrm-fragment-items:start--\x3e",i="\x3c!--storecrm-fragment-items:end--\x3e",r=e.indexOf(n),s=r>=0?e.indexOf(i,r+n.length):-1;if(r>=0&&s>=0){const o=s+i.length,n=null===(t=e.match(/]*data-storecrm-next-cursor)[^>]*>[\s\S]*?<\/button\s*>/i))||void 0===t?void 0:t[0];return e.slice(r,o)+(n||"")}const a=(new DOMParser).parseFromString(e,"text/html"),l=a.querySelector("[data-storecrm-preview-context]");if(l){const e=l.querySelector("[data-storecrm-preview-content]"),t=l.querySelector(".storecrm_favoritelist, .storecrm_customlist"),n=(null==e?void 0:e.innerHTML)||(null==t?void 0:t.outerHTML);if(n)return console.log("StoreCRM: Favorite preview list content extracted from Shopify document",{sourceContainsHead:Boolean(null===(o=a.head)||void 0===o?void 0:o.children.length),usedPreviewContentMarker:Boolean(e)}),n}}return e}findNextCursor(e){const t=e.querySelector("[data-storecrm-next-cursor]");return(null==t?void 0:t.dataset.storecrmNextCursor)||""}removeScripts(e){e.querySelectorAll("script").forEach(e=>e.remove())}stripExecutableScripts(e){return String(e||"").replace(/]*>[\s\S]*?<\/script\s*>/gi,"")}createAdvancedTemplate(e){const t=document.createElement("template");return t.innerHTML=this.stripExecutableScripts(e),this.removeScripts(t.content),t}getAdvancedItemsRoot(e){return e.querySelector("[data-storecrm-items]")}getAdvancedFragmentItems(e){return e.querySelector("[data-storecrm-fragment-items]")}extractMarkedFragmentHtml(e){const t=String(e||""),o="\x3c!--storecrm-fragment-items:start--\x3e",n=t.indexOf(o);if(n<0)return;const i=n+36,r=t.indexOf("\x3c!--storecrm-fragment-items:end--\x3e",i);return r<0?void 0:this.stripExecutableScripts(t.slice(i,r))}appendAdvancedFragment(e,t){const o=this.getFavoriteListRoot();if(!o)return!1;const n=this.getAdvancedItemsRoot(o),i=this.extractMarkedFragmentHtml(e);if(n&&void 0!==i)return n.insertAdjacentHTML("beforeend",i),n.querySelectorAll("script").forEach(e=>e.remove()),!0;const r=this.getAdvancedFragmentItems(t.content);if(n&&r){for(;r.firstChild;)n.appendChild(r.firstChild);return!0}const s=o.querySelector("tbody");if(s){const e=t.content.querySelectorAll("tbody tr");return e.forEach(e=>s.appendChild(e)),e.length>0}return!1}abortLoadMoreRequest(){this.loadMoreAbortController&&(this.loadMoreAbortController.abort(),this.loadMoreAbortController=void 0)}fetchWithTimeout(e){return n(this,arguments,void 0,function*(e,t=15e3){const o=new AbortController;this.loadMoreAbortController=o;const n=window.setTimeout(()=>o.abort(),t);try{return yield fetch(e,{signal:o.signal,cache:"no-store"})}finally{window.clearTimeout(n),this.loadMoreAbortController===o&&(this.loadMoreAbortController=void 0)}})}renderAdvancedPreview(e){return n(this,void 0,void 0,function*(){const t=this.getFavoriteListRoot();if(!t)return void console.warn("StoreCRM: Favorite advanced render skipped because no list root was found");const o=Boolean(this.previewToken)||"true"===t.dataset.storecrmInitialLoading;if(this.previewToken&&this.getAdvancedItemsRoot(t))return this.abortLoadMoreRequest(),this.loadMoreRequestSeq+=1,this.currentIds=e,this.nextCursor=this.findNextCursor(t)||void 0,this.loadingNextPage=!1,this.appendedCursors.clear(),console.log("StoreCRM: Favorite preview uses the server-rendered initial list",{hasNextCursor:Boolean(this.nextCursor)}),this.syncLoadMoreButton(),this.bindAdvancedActionHandlers(t),void(yield this.loadRemainingPagesAutomatically());this.abortLoadMoreRequest();const n=++this.loadMoreRequestSeq;this.currentIds=e,this.nextCursor=void 0,this.loadingNextPage=!1;try{console.log("StoreCRM: Favorite advanced initial page fetch started",{requestSeq:n,ids:"preview"===e?"preview":`${e.split(",").filter(Boolean).length} item(s)`});const i=yield this.fetchWithTimeout(this.buildAdvancedRenderUrl(e));if(console.log("StoreCRM: Favorite advanced initial page response",{requestSeq:n,status:i.status,ok:i.ok}),n!==this.loadMoreRequestSeq||e!==this.currentIds)return void console.log("StoreCRM: Favorite advanced initial page ignored as stale",{requestSeq:n});if(!i.ok)return void console.error("StoreCRM: failed to load favorite list liquid preview",i.status);const r=this.extractAdvancedHtml(yield i.text());if(n!==this.loadMoreRequestSeq||e!==this.currentIds)return;const s=this.createAdvancedTemplate(r),a=s.content.querySelector(".storecrm_favoritelist, .storecrm_customlist");let l=t;if(a&&t.matches(".storecrm_favoritelist, .storecrm_customlist")){document.querySelectorAll("style[data-storecrm-advanced-initial-style]").forEach(e=>e.remove()),document.querySelectorAll("style[data-storecrm-advanced-list-style]").forEach(e=>e.remove()),Array.from(s.content.children).forEach(e=>{e instanceof HTMLStyleElement&&e.setAttribute("data-storecrm-advanced-list-style","true")});const e=s.content.cloneNode(!0),o=e.querySelector(".storecrm_favoritelist, .storecrm_customlist");t.replaceWith(e),o&&(l=o)}else t.replaceChildren(s.content.cloneNode(!0));this.removeScripts(l),this.nextCursor=this.findNextCursor(l)||void 0,this.appendedCursors.clear(),console.log("StoreCRM: Favorite advanced initial page rendered",{hasNextCursor:Boolean(this.nextCursor),loadMoreButtons:l.querySelectorAll("[data-storecrm-next-cursor]").length,replacedListRoot:l!==t}),this.syncLoadMoreButton(),this.bindAdvancedActionHandlers(l),o&&(yield this.loadRemainingPagesAutomatically())}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;console.error("StoreCRM: error rendering advanced favorite list",e)}})}loadRemainingPagesAutomatically(){return n(this,void 0,void 0,function*(){const e=this.getFavoriteListRoot();if(!e)return;const t=document.querySelector("[data-storecrm-preview-context]"),o=Array.from(new Set([e,t].filter(Boolean))),n=(e,t)=>{o.forEach(o=>{o.dataset.storecrmPagesLoaded=e,o.dataset.storecrmPaginationStatus=t,this.previewToken&&(o.dataset.storecrmPreviewPagesLoaded=e,o.dataset.storecrmPreviewPaginationStatus=t)})};n("1",this.nextCursor?"loading":"complete"),console.log("StoreCRM: Favorite automatic pagination started",{isPreview:Boolean(this.previewToken),hasNextPage:Boolean(this.nextCursor)});for(let t=1;t<5&&this.nextCursor;t+=1){const o=this.nextCursor;if(yield this.loadNextPage(),this.nextCursor===o)return n(e.dataset.storecrmPagesLoaded||"1","failed"),void console.warn("StoreCRM: Favorite automatic pagination stopped",{page:t+1,reason:"cursor did not advance"});n(String(t+1),"loading")}n(e.dataset.storecrmPagesLoaded||"1",this.nextCursor?"limited":"complete"),console.log("StoreCRM: Favorite automatic pagination completed",{isPreview:Boolean(this.previewToken),pagesLoaded:e.dataset.storecrmPagesLoaded,hasNextPage:Boolean(this.nextCursor)})})}bindAdvancedActionHandlers(e){this.advancedHandlerRoots.has(e)?console.log("StoreCRM: Favorite advanced click handler already bound",{rootConnected:e.isConnected}):(this.advancedHandlerRoots.add(e),console.log("StoreCRM: Favorite advanced click handler bound",{rootConnected:e.isConnected,loadMoreButtons:e.querySelectorAll("[data-storecrm-next-cursor]").length}),e.addEventListener("click",t=>{var o,n;const r=t.target;if(!(r instanceof Element))return;const s=r.closest("[data-storecrm-next-cursor]");if(s&&e.contains(s))return t.preventDefault(),console.log("StoreCRM: Favorite load-more button clicked",{hasNextCursor:Boolean(this.nextCursor),loading:this.loadingNextPage,rootConnected:e.isConnected,buttonClass:s.className}),void this.loadNextPage();const a=r.closest("[data-cart-variant-id], [data-cart-product-id]");if(a&&e.contains(a)){const e=a.dataset.cartVariantId,o=a.dataset.cartProductId,n=a.dataset.cartProductHandle||"",r=e||o;if(!r)return;return t.preventDefault(),void(0,i.cartFavorite)(this.mode,r,n,this.config.insert_cart_directly,e)}const l=r.closest("a[data-product-id], a[data-variant-id]");if(l&&e.contains(l)){if(!l.dataset.productId)return;t.preventDefault(),this.parent.toggleWishlist(l,!0,null===(o=this.parent.config.favorite)||void 0===o?void 0:o.is_only_member,null===(n=this.parent.config.favorite)||void 0===n?void 0:n.non_member_link)}}))}buildProductsUrl(e,t){const o=(0,i.getFavoriteListRequestedLocale)(),n=new URLSearchParams({mode:this.mode,ids:e});o&&n.set("locale",o),t&&n.set("cursor",t);return`${(0,s.buildAppProxyUrl)("/favorites/products",{path:this.parent.config.appProxyPath,name:this.parent.config.appProxyName})}?${n.toString()}`}loadProductAndRender(e){return n(this,void 0,void 0,function*(){this.currentIds=e,this.appendedCursors.clear();const t=yield fetch(this.buildProductsUrl(e)),o=yield t.json();this.nextCursor=o.next_cursor||void 0,this.renderProducts(o),this.syncLoadMoreButton(),yield this.loadRemainingPagesAutomatically()})}syncLoadMoreButton(){const e=this.getFavoriteListRoot();if(!e)return;let t=e.querySelector("[data-storecrm-next-cursor]");if(!this.nextCursor)return console.log("StoreCRM: Favorite load-more button removed",{buttonFound:Boolean(t)}),void(null==t||t.remove());t||(t=document.createElement("button"),t.type="button",t.classList.add("storecrm_favoritelist_load_more"),t.textContent="\u3082\u3063\u3068\u898b\u308b",e.appendChild(t)),t.dataset.storecrmNextCursor=this.nextCursor,t.style.display="block",t.disabled=this.loadingNextPage,console.log("StoreCRM: Favorite load-more button synchronized",{buttonFound:!0,buttonClass:t.className,loading:this.loadingNextPage,hasNextCursor:!0}),t.setAttribute("aria-busy",this.loadingNextPage?"true":"false"),"advanced"!==this.favoriteListMode&&(t.onclick=()=>this.loadNextPage())}loadNextPage(){return n(this,void 0,void 0,function*(){const e=this.nextCursor;if(!e||this.loadingNextPage||this.appendedCursors.has(e))return void console.log("StoreCRM: Favorite next page request skipped",{hasCursor:Boolean(e),loading:this.loadingNextPage,alreadyAppended:Boolean(e&&this.appendedCursors.has(e))});const t=this.currentIds,o=++this.loadMoreRequestSeq;this.loadingNextPage=!0,console.log("StoreCRM: Favorite next page fetch started",{requestSeq:o,mode:this.favoriteListMode,ids:"preview"===t?"preview":`${t.split(",").filter(Boolean).length} item(s)`,isPreview:Boolean(this.previewToken)}),this.syncLoadMoreButton();try{if("advanced"===this.favoriteListMode){const n=yield this.fetchWithTimeout(this.buildAdvancedRenderUrl(t,e));if(console.log("StoreCRM: Favorite next page response",{requestSeq:o,status:n.status,ok:n.ok}),!n.ok)throw new Error(`Favorite list render failed: ${n.status}`);const i=this.extractAdvancedHtml(yield n.text()),r=this.createAdvancedTemplate(i);if(o!==this.loadMoreRequestSeq||t!==this.currentIds||e!==this.nextCursor)return;if(!this.appendAdvancedFragment(i,r))throw new Error("Favorite list render fragment did not include appendable items");const s=this.findNextCursor(r.content)||void 0;this.nextCursor=s&&s!==e?s:void 0,console.log("StoreCRM: Favorite advanced fragment appended",{requestSeq:o,hasNextCursor:Boolean(this.nextCursor)})}else{const n=yield this.fetchWithTimeout(this.buildProductsUrl(t,e));if(!n.ok)throw new Error(`Favorite list products failed: ${n.status}`);const i=yield n.json();if(o!==this.loadMoreRequestSeq||t!==this.currentIds||e!==this.nextCursor)return;this.renderProducts(i,{append:!0});const r=i.next_cursor||void 0;this.nextCursor=r&&r!==e?r:void 0}this.appendedCursors.add(e),console.log("StoreCRM: Favorite next page fetch completed",{requestSeq:o})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;console.error("StoreCRM: failed to load next favorite list page",e)}finally{o===this.loadMoreRequestSeq&&(this.loadingNextPage=!1,this.syncLoadMoreButton())}})}renderProducts(e,t={}){const o=document.querySelector(".storecrm_favoritelist tbody"),n=document.querySelector(".storecrm_favoritelist_loading"),i=document.querySelector(".storecrm_favoritelist table"),r=document.querySelector(".storecrm_favoritelist_non_item");if(!(o&&n&&i&&o instanceof HTMLElement&&n instanceof HTMLElement&&i instanceof HTMLElement))return;const s="variant"===this.mode?e.variants:e.products;if(s&&0!==s.length){if(!t.append)for(;o.firstChild;)o.removeChild(o.firstChild);s.forEach(e=>o.appendChild(this.createFavoriteRow(o,e))),n.style.display="none",i.style.display="standard"===this.config.layout_preset?"table":"block",r&&(r.style.display="none")}else t.append||(i.style.display="none",n.style.display="none",r&&(r.style.display="block"))}createFavoriteRow(e,t){const o=document.createElement("tr");o.classList.add(`storecrm_favoritelist_id-${t.variant_id||t.product_id}`);const n=(0,i.getLocalePathPrefix)(),s=t.url||("product"===this.mode?`${n}/products/${t.handle}`:`${n}/products/${t.handle}?variant=${t.variant_id}`),a=document.createElement("td");a.classList.add("storecrm_favoritelist_lefttd");const l=document.createElement("div");l.classList.add("storecrm_favoritelist_item");const c=document.createElement("a");if(c.classList.add("storecrm_favoritelist_media","storecrm_favoritelist_image_link"),c.href=s,c.setAttribute("aria-label",t.title),t.thumbnail_url){const e=document.createElement("img");e.classList.add("storecrm_favoritelist_img"),e.src=t.thumbnail_url,e.alt=t.title,c.appendChild(e)}else{const e=document.createElement("span");e.classList.add("storecrm_favoritelist_image_placeholder"),e.textContent=this.getListCopy().noImage,c.appendChild(e)}l.appendChild(c);const d=document.createElement("div");d.classList.add("storecrm_favoritelist_product_info");const u=document.createElement("a");if(u.classList.add("storecrm_favoritelist_title"),u.href=s,u.textContent=t.title,d.appendChild(u),!1!==this.config.show_stock_status){const e=document.createElement("span");e.classList.add("storecrm_favoritelist_status",t.available?"is-available":"is-unavailable"),e.textContent=t.available?this.getListCopy().available:this.getListCopy().unavailable,d.appendChild(e)}l.appendChild(d),a.appendChild(l);const h=document.createElement("td");h.classList.add("storecrm_favoritelist_righttd");const m=document.createElement("div");if(m.classList.add("storecrm_favoritelist_links"),this.config.show_cart&&t.available){const e=document.createElement("a");e.classList.add("storecrm_favoritelist_link"),e.innerHTML=(0,r.getCartIcon)(this.config.cart_icon);const o="product_link"===this.config.cart_icon?this.getListCopy().product:this.getListCopy().cart;e.setAttribute("aria-label",o);const n=document.createElement("span");n.classList.add("storecrm_favoritelist_action_label"),n.textContent=o,e.appendChild(n),"product_link"===this.config.cart_icon?e.href=s:(e.href="javascript:void(0);",e.onclick=()=>(0,i.cartFavorite)(this.mode,"product"==this.mode?t.variant_id||t.product_id:t.variant_id||"",t.handle,this.config.insert_cart_directly,t.variant_id)),m.appendChild(e)}const p=document.createElement("a");p.classList.add("storecrm_favoritelist_link"),p.href="javascript:void(0);",p.innerHTML=r.iconDelete,p.setAttribute("aria-label",this.getListCopy().remove);const g=document.createElement("span");return g.classList.add("storecrm_favoritelist_action_label"),g.textContent=this.getListCopy().remove,p.appendChild(g),"product"==this.mode||(p.dataset.variantId=t.variant_id),p.dataset.productId=t.product_id,p.onclick=()=>this.parent.toggleWishlist(p,!0,this.parent.config.favorite.is_only_member,this.parent.config.favorite.non_member_link),m.appendChild(p),h.appendChild(m),o.appendChild(a),o.appendChild(h),o}getListCopy(){return((0,i.getFavoriteListRequestedLocale)()||document.documentElement.lang||"ja").toLowerCase().startsWith("ja")?{available:"\u5728\u5eab\u3042\u308a",unavailable:"\u5728\u5eab\u5207\u308c",cart:"\u30ab\u30fc\u30c8\u306b\u8ffd\u52a0",product:"\u5546\u54c1\u3092\u898b\u308b",remove:"\u524a\u9664",noImage:"\u753b\u50cf\u306a\u3057"}:{available:"In stock",unavailable:"Out of stock",cart:"Add to cart",product:"View product",remove:"Remove",noImage:"No image"}}}t.Renderer=l,l.instance=void 0},718(e,t){t.getCartIcon=t.b0=t.U2=t.S$=t.o6=t.iconDelete=void 0,t.iconDelete='',t.o6='',t.S$='',t.U2='',t.b0='';t.getCartIcon=e=>"cart_plus"===e?t.S$:"bag"===e?t.U2:"product_link"===e?t.b0:t.o6},805(e,t){var o=this&&this.__awaiter||function(e,t,o,n){return new(o||(o=Promise))(function(i,r){function s(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})};function n(e){if("string"!=typeof e)return"";const t=e.trim();if(!t||"/"===t||"//"===t)return"";const o=/^[a-z]{2}(?:-[a-z]{2})?$/i.test(t)?`/${t}/`:t;if(!o.startsWith("/"))return"";const n=("/"+o).replace(/\/{2,}/g,"/").replace(/\/$/,"").toLowerCase();return"/"===n?"":n}function i(e){const t=window.location.pathname.toLowerCase();return t===e||t.startsWith(`${e}/`)}function r(){var e,t,o,r,s,a,l,c;const d=n((null===(t=null===(e=null===window||void 0===window?void 0:window.Shopify)||void 0===e?void 0:e.routes)||void 0===t?void 0:t.root)||(null===(r=null===(o=null===window||void 0===window?void 0:window.Shopify)||void 0===o?void 0:o.localization)||void 0===r?void 0:r.root));if(d)return i(d)?d:"";const u=n((null===(l=null===(a=null===(s=null===window||void 0===window?void 0:window.Shopify)||void 0===s?void 0:s.localization)||void 0===a?void 0:a.language)||void 0===l?void 0:l.isoCode)||(null===(c=null===window||void 0===window?void 0:window.Shopify)||void 0===c?void 0:c.locale));return u&&i(u)?u:""}function s(e){return o(this,arguments,void 0,function*(e,t=""){try{const o=yield fetch(`${t||""}/cart/add.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,quantity:1})});if(!o.ok)throw new Error(`Failed to add to cart: ${o.statusText}`);const n=yield o.json();console.log("StoreCRM: \u5546\u54c1\u304c\u30ab\u30fc\u30c8\u306b\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f:",n),window.location.href=`${t}/cart`}catch(e){console.error("StoreCRM: \u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f:",e),alert("\u30ab\u30fc\u30c8\u306b\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002")}})}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalePathPrefix=r,t.getFavoriteListRequestedLocale=function(){var e,t,o,n;return r()?String((null===(o=null===(t=null===(e=null===window||void 0===window?void 0:window.Shopify)||void 0===e?void 0:e.localization)||void 0===t?void 0:t.language)||void 0===o?void 0:o.isoCode)||(null===(n=null===window||void 0===window?void 0:window.Shopify)||void 0===n?void 0:n.locale)||""):""},t.cartFavorite=function(e,t,o,n,i){const a=r(),l=i||("variant"===e?t:"");if(l&&("variant"===e||n))return void s(l,a);const c="variant"===e?`${a}/products/${encodeURIComponent(o)}?variant=${t}`:`${a}/products/${encodeURIComponent(o)}`;window.location.href=c},t.addToCart=s},430(e,t){Object.defineProperty(t,"__esModule",{value:!0});class o{constructor(e){this.loginButtonImg="/buttons/images/line_login_btn.png",this.parent=e}static isLoginOrRegisterPage(){const e=window.location.pathname,t=o.isLoginPath(e),n=o.isRegisterPath(e);if(t||n)return!0;const i=o.isLoginPage(),r=o.isRegisterPage();return!(!i&&!r)}static isLineLoginEnabled(){return window.storecrm_config.line&&window.storecrm_config.line.line_login_enable?!(window.storecrm_config.line.line_login_onlypreview&&!(window.Shopify&&window.Shopify.designMode||document.querySelector("#OnlineStorePreviewBarNextData")))||(console.info("StoreCRM: line_login_onlypreview is set, but not in Shopify designMode. LINE login will not be initialized."),!1):(console.info("StoreCRM: line_login_enable is not set or false. LINE login will not be initialized."),!1)}init(){if(o.isLineLoginEnabled())try{const e=document.querySelectorAll(`.${o.CUSTOM_CONTAINER_CLASS}`);if(e.length>0)return void e.forEach(e=>{const t=this.createLineButton(!0);e.appendChild(t)});o.isLoginPage()&&this.addLoginButton(),o.isRegisterPage()&&this.addRegisterButton(),this.clearSessionStorage()}catch(e){console.error("Error in init:",e)}}clearSessionStorage(){location.pathname.includes("/register")||(sessionStorage.removeItem("line_email"),sessionStorage.removeItem("line_lineId"))}static isLoginPage(){try{return!!document.querySelector('form[action*="login"], form[action*="sign_in"]')}catch(e){return console.error("Error in isLoginPage:",e),!1}}static isRegisterPage(){try{return!!document.querySelector('form[action^="/account"]')}catch(e){return console.error("Error in isRegisterPage:",e),!1}}addLoginButton(){var e;const t=document.querySelector('form[action*="/account/login"]');if(!t)return;let o=t.querySelector('button[type="submit"]');if(o||(o=t.querySelector("button")),!o){const e=document.createElement("div");e.className="line-login-container",e.style.marginTop="20px",e.style.textAlign="center";const o=this.createLineButton(!0);return e.appendChild(o),void t.appendChild(e)}const n=document.createElement("div");n.className="line-login-container",n.style.marginTop="20px",n.style.textAlign="center";const i=this.createLineButton(!0);n.appendChild(i),null===(e=o.parentNode)||void 0===e||e.insertBefore(n,o.nextSibling)}addRegisterButton(){var e;const t=document.querySelector('form[action^="/account"]');if(!t)return;const o=new URLSearchParams(window.location.search);let n=o.get("email"),i=o.get("line_id");if(n?sessionStorage.setItem("line_email",n):n=sessionStorage.getItem("line_email"),i?sessionStorage.setItem("line_lineId",i):i=sessionStorage.getItem("line_lineId"),n&&n.includes("@")){const e=t.querySelector('input[name="customer[email]"]');e&&(e.value=n)}if(i){let e=t.querySelector('input[name="customer[note][lineId]"]');e||(e=document.createElement("input"),e.type="hidden",e.name="customer[note][lineId]",t.appendChild(e)),e.value=i}if(i||n)try{const e=t,o=new URL(e.action,window.location.origin);i?o.searchParams.set("line_id",i):o.searchParams.delete("line_id"),n?o.searchParams.set("email",n):o.searchParams.delete("email"),e.action=o.pathname+(o.search?o.search:"")}catch(e){console.error("Failed to update form action with line_id/email:",e)}if(i){const e=document.createElement("div");return e.textContent="LINE\u30ed\u30b0\u30a4\u30f3\u3092\u884c\u3044\u307e\u3057\u305f\u3002\u9023\u643a\u3092\u884c\u3063\u3066\u4f1a\u54e1\u767b\u9332\u3092\u884c\u3046\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u30d5\u30a9\u30fc\u30e0\u3088\u308a\u3054\u767b\u9332\u304f\u3060\u3055\u3044",e.style.color="#d32f2f",e.style.fontWeight="bold",e.style.fontSize="13px",e.style.marginBottom="20px",e.style.textAlign="center",void t.insertBefore(e,t.firstChild)}let r=t.querySelector('button[type="submit"]');if(r||(r=t.querySelector("button")),!r){const e=document.createElement("div");e.className="line-login-container",e.style.marginTop="20px",e.style.textAlign="center";const o=this.createLineButton(!1);return e.appendChild(o),void t.appendChild(e)}const s=document.createElement("div");s.className="line-login-container",s.style.marginTop="20px",s.style.textAlign="center";const a=this.createLineButton(!1);s.appendChild(a),null===(e=r.parentNode)||void 0===e||e.insertBefore(s,r.nextSibling)}createLineButton(e=!0){if(!document.getElementById("btn-line-login-style")){const e=document.createElement("style");e.id="btn-line-login-style",e.innerHTML=".btn-line-login::after { box-shadow: none !important; }",document.head.appendChild(e)}const t=document.createElement("button");t.type="button",t.className="btn-line-login",t.style.backgroundColor="#06C755",t.style.color="#FFFFFF",t.style.border="none",t.style.borderRadius="4px",t.style.padding="0 6px",t.style.cursor="pointer",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.width="auto",t.style.height="48px",t.style.marginBottom="10px",t.style.textAlign="center",t.style.fontWeight="bold",t.style.fontSize="16px",t.style.letterSpacing="0.03em",t.style.boxShadow="0 2px 4px 0 rgba(0,0,0,0.04)",t.style.transition="background 0.2s",t.style.position="relative",t.style.overflow="hidden",t.style.boxSizing="border-box",t.style.marginTop="12px",t.style.marginBottom="12px",t.style.paddingTop="0",t.style.paddingBottom="0",t.onmouseover=()=>{t.style.backgroundColor="#06C755",t.style.filter="brightness(0.95)"},t.onmouseout=()=>{t.style.backgroundColor="#06C755",t.style.filter="none"},t.onmousedown=()=>{t.style.backgroundColor="#06C755",t.style.filter="brightness(0.85)"},t.onmouseup=()=>{t.style.backgroundColor="#06C755",t.style.filter="brightness(0.95)"};const n=document.createElement("span");n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="center",n.style.marginRight="12px",n.style.width="32px",n.style.height="32px",n.style.flexShrink="0",n.style.background="none";const i=document.createElement("img");i.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAACpUlEQVRYhe2XTYhNURzAf8cMZSQSRT4LSRaGfISNlLJ8WUiUUMrKRoqFlUyyQNnY2tnaaEI2vmZKeoo0YUE+UhYTEoN+FveOnjvn3ufNu++N9H6re+85//P/nf875577oEOHDh3+K0IzwWo3sAXYDqwDlgMLgClplxHgNfAMeADcBO6EEH40k3c8ovPUs+p7G+d9GjuvHaLT1DPqt3GIZhlJx5rWKtledagE0SxDam/ZstvUTy2QHeWTuq0s2c3qlxbKjvJF3VzPp/Atoc4GqsD8UmZfnzdAbwjhQ16HSXUG6KN9sqS5+oo65FZYXQy8ALpKlqrHT2BpCOFlrLG7IHAfY2WHgGFgY+b5C+AtsAl4BbwjOVBGeUJyiKwC7mdie4D1Nfddae5TBW5jUe9GNsbWtC1LJX1eVfen1xdq2teoS9RqJM/MyHh387yKKryqoRmO5RiwgaTqZiQrQCW9jR0cubmLNt2MBgWzTAV2AbEd/5VkaQ0DHxvJXVThZrkM7AT2kGyk34QQ+oF+SJYEcPBvBy2qcHSXNkAFOBpCuAE8rm1QD6frvQoMRGJf5Q1aVOFBYHFO24Ga66LqnFEHQwi39Y9lPECyLABmAuczcfcKxoyj7o7s3h2RfpfSvkF9qh5Su2ti3qpz1eXq40j8nEienXleRQfHFOA5sLDh2TbHc2Bl3kd+7hoOIYwAx1tlVcCRpv6RqFciP1mruNj0dNUe46de2VxXJzctnEpPV6+1UPaW2lOKbI30JPWE+rVk2auly2bEl5ms658lyJ5T2/P5qi5ST6qPxiH6Wd3dFtEc+VnqdvW4+qyO7EN1xYTJZlHX5Yh+V0+bHEj/DuraiOwDdfVEu0VR99aIDqtHbdfGGg8mn46fTd4Asyfap0OHDh3+cX4BcUOZ2CqT2BUAAAAASUVORK5CYII=",i.width=32,i.height=32,i.alt="LINE",i.style.display="block",i.style.width="32px",i.style.height="32px",n.appendChild(i);const r=document.createElement("span");r.textContent=e?o.BUTTON_TEXT:o.REGISTER_BUTTON_TEXT,r.style.display="inline-block",r.style.whiteSpace="nowrap",r.style.fontWeight="bold",r.style.fontSize="16px",r.style.lineHeight="1",r.style.letterSpacing="0.03em",r.style.userSelect="none",r.style.padding="0 32px",t.appendChild(n),t.appendChild(r);const s=document.createElement("div");s.className="line-login-container",s.style.display="flex",s.style.justifyContent="center",s.style.alignItems="center",s.style.width="100%",s.style.marginTop="20px",s.style.marginBottom="10px",s.appendChild(t),t.onclick=()=>{this.parent.doLineLogin()};const a=new URLSearchParams(window.location.search).get("line_login_error"),l=document.createElement("div");if(l.style.display="flex",l.style.flexDirection="column",l.style.alignItems="center",l.style.width="100%",l.appendChild(s),a){const e=document.createElement("div");e.textContent=a,e.style.color="#d32f2f",e.style.fontWeight="bold",e.style.fontSize="13px",e.style.marginTop="0px",e.style.marginBottom="15px",e.style.textAlign="center",l.appendChild(e)}return l}static isLoginPath(e){return"/account/login"===e||/\blogin\b/i.test(e)}static isRegisterPath(e){return"/account/register"===e||(/\bregister\b/i.test(e)||/\bsignup\b/i.test(e))}}o.BUTTON_CLASS="line-login-button",o.CUSTOM_CONTAINER_CLASS="line-login-custom-container",o.instance=null,o.BUTTON_TEXT="LINE\u3067\u30ed\u30b0\u30a4\u30f3",o.REGISTER_BUTTON_TEXT="LINE\u3067\u767b\u9332",t.default=o},203(e,t,o){var n=this&&this.__awaiter||function(e,t,o,n){return new(o||(o=Promise))(function(i,r){function s(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.schema=t.LineRestockPopupManager=void 0;const r=i(o(132)),s="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiPjxyZWN0IHdpZHRoPSIxMDAwIiBoZWlnaHQ9IjEwMDAiIGZpbGw9IiNjOWVkZmIiLz48cGF0aCBkPSJNMzA3IDY3NWM4LTc4IDM3LTExMyAxMDEtMTQzbDU3LTI3YzIyLTEwIDMyLTM0IDI3LTY4bC0xMi04MWMtMzEtMTAtNTMtMzgtNTMtNzIgMC0zMSAxNy01NSA0NC02NyAxMy04NyA3My0xMzAgMTQzLTEzMHMxMzAgNDMgMTQzIDEzMGMyNyAxMiA0NCAzNiA0NCA2NyAwIDM0LTIyIDYyLTUzIDcybC0xMiA4MWMtNSAzNCA1IDU4IDI3IDY4bDU3IDI3YzY0IDMwIDkzIDY1IDEwMSAxNDMgMiAyMy0xNSA0My0zOCA0NC0xNzcgOC0zNTUgOC01MzIgMC0yMy0xLTQwLTIxLTM4LTQ0eiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTExNCA5NikiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSI1NiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PC9zdmc+",a={"&":"&","<":"<",">":">",'"':""","'":"'"};function l(e){return String(null!=e?e:"").replace(/[&<>"']/g,e=>a[e])}class c{constructor(e,t=!1){this.preview=!1,this.inited=!1,this.container=null,this.title=null,this.content=null,this.footer=null,this.button=null,this.lineLoginButton=null,this.close=null,this.product_id=null,this.variants=[],this.line_profile=null,this.preview=t,this.config=e,this.init()}static getInstance(e,t=!1){return c.instance?(c.instance.config=e,c.instance.preview=t):c.instance=new c(e,t),c.instance}setParent(e){this.parent=e}renderTemplate(){document&&document.body?document.body.insertAdjacentHTML("beforeend",c.template):window.setTimeout(this.renderTemplate.bind(this),100)}init(){document&&document.body?this.runInit():window.setTimeout(this.init.bind(this),100)}runInit(){this.inited=!0,this.preview||document.body.insertAdjacentHTML("beforeend",c.template),r.default.init(),this.updateElements(),this.container&&this.container.addEventListener("click",e=>{e.stopPropagation()}),this.close&&!this.preview&&this.close.addEventListener("click",e=>{r.default.close("storecrm-line-restock-modal")})}updateElements(){this.container=document.getElementById("storecrm-line-restock-modal"),this.title=document.getElementById("storecrm-line-restock-title"),this.content=document.getElementById("storecrm-line-restock-content"),this.footer=document.getElementById("storecrm-line-restock-footer"),this.close=document.getElementById("storecrm-line-restock-close")}getLineProfileFromURL(){try{const e=new URLSearchParams(window.location.search).get("line_profile_data");if(e){const t=atob(e),o=JSON.parse(t),n={display_name:o.displayName||"",picture_url:"string"==typeof o.pictureUrl?o.pictureUrl:null,line_customer_id:o.userId||""};window.sessionStorage.setItem("storecrm_line_profile",JSON.stringify(n));const i=new URL(window.location.href);return i.searchParams.delete("line_profile_data"),window.history.replaceState({},"",i.toString()),n}}catch(e){console.error("StoreCRM: Failed to parse line profile from URL",e)}}getLineProfileFromSessionStorage(){try{const e=window.sessionStorage.getItem("storecrm_line_profile");if(e)return JSON.parse(e)}catch(e){console.error("StoreCRM: Failed to parse line profile from session storage",e)}}render(e,t,o,n={}){var i;this.preview&&this.updateElements();let r=!1;if(o||this.preview||((o=this.getLineProfileFromURL())?r=!0:o=this.getLineProfileFromSessionStorage()),o&&!this.preview&&(null!=o.display_name&&null!=o.line_customer_id||(o=void 0,window.sessionStorage.removeItem("storecrm_line_profile"))),!this.title||!this.content||!this.footer)return;const a=document.createElement("button");a.className="storecrm_modal__btn storecrm_modal__btn-primary",a.innerHTML=e.button_text||"\u518d\u5165\u8377\u901a\u77e5\u3092\u6709\u52b9\u306b\u3059\u308b";const c=document.createElement("button");c.className="storecrm_modal__btn storecrm_modal__btn-primary storecrm_modal__btn-line-login",c.innerHTML="LINE\u9023\u643a\u3092\u884c\u3046",o||this.preview||(a.style.display="none",c.style.display="block"),o&&!this.preview&&(c.style.display="none",a.style.display="block"),0!==this.footer.children.length&&(this.footer.innerHTML=""),this.button=null,this.lineLoginButton=null,n.hideSubmitButton||(this.footer.appendChild(a),this.footer.appendChild(c),this.button=a,this.lineLoginButton=c),this.button&&!this.preview&&(this.button.addEventListener("click",()=>{this.handleEnableClick()}),null===(i=this.lineLoginButton)||void 0===i||i.addEventListener("click",()=>{this.handleLineSubscribeClick()})),this.config=e,this.title.innerText=e.title||"LINE\u518d\u5165\u8377\u901a\u77e5";const d=n.readOnly?' disabled aria-disabled="true"':"";let u=`\n
${e.description_text||"\u3053\u306e\u5546\u54c1\u306e\u518d\u5165\u8377\u3092LINE\u3067\u304a\u77e5\u3089\u305b\u3057\u307e\u3059"}
\n
\n `,h=n.variantId||null;if(location.search&&location.search.includes("variant")){const e=new URL(location.href);h=h||e.searchParams.get("variant")}const m=t.filter(e=>!e.available).map(e=>``).join("");if(t&&Array.isArray(t)&&t.length>1?(u=u.replace("\x3c!-- select_style --\x3e",""),u=u.replace("\x3c!-- options --\x3e",m)):(u=u.replace("\x3c!-- select_style --\x3e","display:none"),u=u.replace("\x3c!-- options --\x3e",m)),o||this.preview){this.line_profile=o||{display_name:"LINE\u9867\u5ba2\u540d",picture_url:s,line_customer_id:"preview-user"};u+=`\n
\n avatar\n
${l(this.line_profile.display_name)}
\n
`}var p;u+='
',this.content.innerHTML=u;const g=this.content.querySelector("#storecrm-line-restock-profile-image");if(g&&g.addEventListener("error",()=>{g.getAttribute("src")!==s&&(g.src=s)}),this.content.style.color=e.text_color||"#000000",this.container){const t=this.container.querySelector(".storecrm_modal__container");t&&(t.style.backgroundColor=e.background_color||"#ffffff",t.style.borderRadius=`${e.popup_radius||10}px`)}this.button&&(this.button.style.backgroundColor=e.button_background_color||"#222222",this.button.style.color=e.button_text_color||"#dddddd",this.button.style.borderRadius="4px"),this.lineLoginButton&&(this.lineLoginButton.style.backgroundColor="#06C755",this.lineLoginButton.style.color="#ffffff",this.lineLoginButton.style.borderRadius="4px"),this.close&&(this.close.style.color=e.close_text_color||"#000000"),this.resetMessage(),this.preview&&(this.success(e.success_text||"\u518d\u5165\u8377\u901a\u77e5\u304c\u767b\u9332\u3055\u308c\u307e\u3057\u305f\uff01"),this.failure(e.error_text||"\u518d\u5165\u8377\u901a\u77e5\u306e\u767b\u9332\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002"),this.container&&this.container.querySelectorAll(".storecrm_modal__overlay,.storecrm_modal__close").forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation()})}))}handleEnableClick(){return n(this,void 0,void 0,function*(){var e,t,o;if(this.preview)return;this.resetMessage(),this.disableButton();const n=null===(e=this.content)||void 0===e?void 0:e.querySelector("#storecrm_restock_variant"),i=n?n.value:"";this.parent&&this.parent.storeLineRestock(this.product_id,i,null===(t=this.line_profile)||void 0===t?void 0:t.line_customer_id,null===(o=this.line_profile)||void 0===o?void 0:o.display_name,JSON.stringify(this.line_profile),this.success.bind(this),this.failure.bind(this))})}handleLineSubscribeClick(){return n(this,void 0,void 0,function*(){var e,t,o;if(this.preview)return;this.resetMessage(),this.disableButton();const n=null===(t=null===(e=this.content)||void 0===e?void 0:e.querySelector("#storecrm_restock_variant"))||void 0===t?void 0:t.value;try{if(null===(o=this.parent)||void 0===o?void 0:o.startLineRestockConnectFromPopup)return void(yield this.parent.startLineRestockConnectFromPopup(this.product_id,this.variants,{buttonId:this.button_id,variantId:n}));this.parent&&this.parent.lineSubscribe(function(e){alert(e)})}catch(e){this.enableButton(),alert(e)}})}resetMessage(){this.footer&&this.footer.querySelectorAll(".storecrm_modal_message").forEach(e=>e.remove())}disableButton(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.innerText="\u9001\u4fe1\u4e2d...")}enableButton(){this.button&&(this.button.removeAttribute("disabled"),this.button.innerText=this.config.button_text||"\u518d\u5165\u8377\u901a\u77e5\u3092\u6709\u52b9\u306b\u3059\u308b")}success(e){this.enableButton();const t=document.createElement("div");t.classList.add("storecrm_modal_success","storecrm_modal_message"),t.style.color=this.config.success_text_color||"#166534",t.style.backgroundColor=this.config.success_background_color||"#F0FDF4",t.style.padding="1rem",t.style.marginTop="1rem",t.style.borderRadius="4px",t.innerText=e,this.footer&&this.footer.appendChild(t)}failure(e){this.enableButton();const t=document.createElement("div");t.classList.add("storecrm_modal_error","storecrm_modal_message"),t.style.color=this.config.error_text_color||"#991B1B",t.style.backgroundColor=this.config.error_background_color||"#FEF2F2",t.style.padding="1rem",t.style.marginTop="1rem",t.style.borderRadius="4px",t.innerText=e,this.footer&&this.footer.appendChild(t)}show(e,t,o,n,i={}){this.product_id=o,this.button_id=i.buttonId,this.variants=Array.isArray(t)?t:[],this.inited?this.runShow(e,t,n,i):window.setTimeout(()=>this.show(e,t,o,n,i),100)}runShow(e,t,o,n={}){this.render(e,t,o,n);if(document.getElementById("storecrm-line-restock-modal"))try{r.default.show("storecrm-line-restock-modal",{disableFocus:!0})}catch(e){console.warn("StoreCRM: line restock popup show failed",e)}else console.warn("StoreCRM: line restock popup modal element not found, skip show")}hide(){if(document.getElementById("storecrm-line-restock-modal"))try{r.default.close("storecrm-line-restock-modal")}catch(e){console.warn("StoreCRM: line restock popup close failed",e)}}}t.LineRestockPopupManager=c,c.template='';let d=null;t.schema={preview:(e,t)=>{var o,n;return o=()=>{c.getInstance(e,!0).show(e,[],"1234567890",void 0)},n=300,clearTimeout(d),d=setTimeout(o,n),c.template},rows:[{type:"text",slug:"title",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30bf\u30a4\u30c8\u30eb",nameEn:"Popup title",defaultJa:"LINE\u518d\u5165\u8377\u901a\u77e5",defaultEn:"LINE Restock Notification"},{type:"text",slug:"description_text",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u672c\u6587",nameEn:"Popup description",defaultJa:"\u3053\u306e\u5546\u54c1\u306e\u518d\u5165\u8377\u3092LINE\u3067\u304a\u77e5\u3089\u305b\u3057\u307e\u3059",defaultEn:"We will notify you via LINE when this product is restocked."},{type:"colorpicker",slug:"background_color",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u80cc\u666f\u8272",nameEn:"Popup background color",default:"#ffffff"},{type:"colorpicker",slug:"text_color",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u8272",nameEn:"Text color",default:"#000000"},{type:"colorpicker",slug:"close_text_color",nameJa:"\u9589\u3058\u308b\u30dc\u30bf\u30f3\u306e\u8272",nameEn:"Popup close button text color",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"Button background color",default:"#222222"},{type:"colorpicker",slug:"button_text_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8\u30ab\u30e9\u30fc",nameEn:"Button text color",default:"#dddddd"},{type:"text",slug:"button_text",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Button text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u6709\u52b9\u306b\u3059\u308b",defaultEn:"Enable restock notification"},{type:"text",slug:"success_text",nameJa:"\u6210\u529f\u6642\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Success text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u304c\u767b\u9332\u3055\u308c\u307e\u3057\u305f\uff01",defaultEn:"Restock notification registered!"},{type:"colorpicker",slug:"success_background_color",nameJa:"\u6210\u529f\u6642\u306e\u80cc\u666f\u8272",nameEn:"Success background color",default:"#F0FDF4"},{type:"colorpicker",slug:"success_text_color",nameJa:"\u6210\u529f\u6642\u306e\u6587\u5b57\u8272",nameEn:"Success text color",default:"#166534"},{type:"text",slug:"error_text",nameJa:"\u5931\u6557\u6642\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Error text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u306e\u767b\u9332\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002",defaultEn:"Failed to register restock notification. Please try again later."},{type:"colorpicker",slug:"error_background_color",nameJa:"\u30a8\u30e9\u30fc\u6642\u306e\u80cc\u666f\u8272",nameEn:"Error background color",default:"#FEF2F2"},{type:"colorpicker",slug:"error_text_color",nameJa:"\u30a8\u30e9\u30fc\u6642\u306e\u6587\u5b57\u8272",nameEn:"Error text color",default:"#991B1B"},{type:"range",slug:"popup_radius",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u4e38\u307f",nameEn:"Popup border radius",default:10,min:0,max:20,step:1}]}},482(e,t){t.schema=t.render=t.generateDefaultSettings=t.LineRestockButton=void 0;class o{constructor(e,t,o,n,i){this.eventTriggered=!1,this.variants=o,this.buttonSettings=n,this.productId=t,this.product=i}static getInstance(e,t=null,n=null,i=null,r=null){if(o.instances[e])i&&(o.instances[e].buttonSettings=i);else{if(!(t&&n&&i&&r))throw new Error("StoreCRM LineRestock: productId, variants, buttonSettings, product are required");o.instances[e]=new o(e,t,n,i,r)}return o.instances[e]}createScript(e,t){const o=e?"onclick=\"event.preventDefault();(function(){ const el=document.getElementById('storecrm-line-restock-modal'); if(el){ el.style.display='flex'; } })();\"":`onclick="event.preventDefault();window.storecrm ? window.storecrm.showLineRestockPopup('${t}') : alert('\u8aad\u8fbc\u4e2d\u3067\u3059\u3002\u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002');"`;return`\n\n\n
\n\n
\n `}checkRender(e){document.querySelectorAll(`.storecrm-line-restock-${e}`).forEach(t=>{var o,n;if(t instanceof HTMLElement&&t.closest('[data-type="line-restock-button"]')){const i=new URL(location.href),r=(null===(o=this.variants.find(e=>e.available))||void 0===o?void 0:o.id)||this.variants[0].id||null,s=parseInt(i.searchParams.get("variant")||r,10);if(!s)return void console.error("StoreCRM Restock: variantId is not set",s);if(!this.product||!this.product.tags||this.product.tags.indexOf("storecrm-restock-hidden")>=0)return void(t.style.display="none");const a=window.Shopify&&window.Shopify.designMode||this.variants.find(e=>!e.available&&e.id===s);t.style.display=a?"inline-block":"none";const l=new URLSearchParams(window.location.search),c=l.get("line_login_error");if(c)return console.error("LINE\u30ed\u30b0\u30a4\u30f3\u95a2\u9023\u306e\u30a8\u30e9\u30fc:",c),void this.removeLineConnectResultParamsFromUrl(!0);if(l.get("line_connect"))return this.hasPendingLineRestockIntent()?void this.removeLineConnectResultParamsFromUrl():(this.removeLineConnectResultParamsFromUrl(),void(null===(n=window.storecrm)||void 0===n||n.showLineRestockPopup(e)))}})}removeLineConnectResultParamsFromUrl(e=!1){try{const t=new URL(window.location.href),o=t.toString();t.searchParams.delete("line_connect"),t.searchParams.delete("line_login_error"),e&&t.searchParams.delete("line_profile_data"),t.toString()!==o&&window.history.replaceState({},"",t.toString())}catch(e){console.warn("StoreCRM LineRestock: failed to clean LINE connect params",e)}}hasPendingLineRestockIntent(){try{const e=window.localStorage.getItem(o.PENDING_RESTOCK_INTENT_KEY);if(!e)return!1;const t=JSON.parse(e);return"line"===(null==t?void 0:t.channel)&&(!(!t.created_at||Date.now()-t.created_at>o.PENDING_RESTOCK_INTENT_TTL_MS)||(window.localStorage.removeItem(o.PENDING_RESTOCK_INTENT_KEY),!1))}catch(e){return window.localStorage.removeItem(o.PENDING_RESTOCK_INTENT_KEY),!1}}render(e,t=!1){if(t)return this.createScript(!0,e);if(!this.eventTriggered){if(this.eventTriggered=!0,window.navigation)window.navigation.addEventListener("navigate",()=>{window.setTimeout(()=>this.checkRender(e),100)}),window.setTimeout(()=>this.checkRender(e),100),window.setTimeout(()=>this.checkRender(e),1e3);else{let t=location.href;window.setInterval(()=>{t!==location.href&&(t=location.href,this.checkRender(e))},1e3),window.setTimeout(()=>this.checkRender(e),100),window.setTimeout(()=>this.checkRender(e),1e3)}return this.createScript(!1,e)}}}t.LineRestockButton=o,o.instances={},o.PENDING_RESTOCK_INTENT_KEY="storecrm_pending_restock_intent",o.PENDING_RESTOCK_INTENT_TTL_MS=864e5;t.generateDefaultSettings=(e="ja")=>{const o={};return t.schema.rows.forEach(t=>{"text"===t.type?o[t.slug]="ja"===e?t.defaultJa:t.defaultEn:(t.type,o[t.slug]=t.default)}),o};t.render=({productId:e,variantId:t,variants:n,id:i,buttonSettings:r,isOutOfStock:s,product:a,preview:l=!1})=>o.getInstance(i,e,n,r,a).render(i,l);const n=e=>{const t=[`opacity: ${((e,t,o,n)=>{const i=Number(e);return Number.isFinite(i)?Math.min(n,Math.max(o,i)):t})(e.registered_button_opacity,.55,.3,1)}`,"cursor: not-allowed","pointer-events: none"];return e.registered_button_color&&t.push(`color: ${e.registered_button_color}`),e.registered_button_background_color&&t.push(`background-color: ${e.registered_button_background_color}`),e.registered_button_border_color&&t.push(`border-color: ${e.registered_button_border_color}`),t.join("; ")},i=(e,t,o)=>{const i=t.registered_button_text||("ja"===o?"LINE\u767b\u9332\u6e08\u307f":"LINE registered");return`\n
\n
${"ja"===o?"\u767b\u9332\u6e08\u307f\u8868\u793a":"Registered state"}
\n ${(e||"").replace(/]*)>[\s\S]*?<\/button>/,(e,o)=>{const r=String(o||"").replace(/\sonclick="[^"]*"/g,"");return`${s=i,String(null!=s?s:"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}`;var s})}\n
`};t.schema={preview:(e,o)=>((e,t,o,n)=>`\n
\n
\n
${"ja"===n?"\u901a\u5e38\u8868\u793a":"Default state"}
\n ${e||""}\n
\n ${i(t,o,n)}\n
`)((0,t.render)({productId:"TEMP_productId",id:"TEMP_line_restock",buttonSettings:e,isOutOfStock:!1,preview:!0,product:{tags:[]},variants:[]}),(0,t.render)({productId:"TEMP_productId",id:"TEMP_line_restock_registered",buttonSettings:e,isOutOfStock:!1,preview:!0,product:{tags:[]},variants:[]}),e,o),info:{textJa:"\u30ef\u30f3\u30b9\u30c6\u30c3\u30d7\u3067\u518d\u5165\u8377\u901a\u77e5\u3092LINE\u3067\u53d7\u3051\u53d6\u308c\u308b\u30dc\u30bf\u30f3\u3092\u8a2d\u7f6e\u3057\u307e\u3059\u3002",textEn:"Set up a button that allows customers to receive restock notifications via LINE in one step.",noteJa:'\u203b\u672c\u6a5f\u80fd\u3092\u6709\u52b9\u306b\u3059\u308b\u306b\u306fLINE\u9023\u643a\u8a2d\u5b9a\u304c\u5b8c\u4e86\u3057\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002',noteEn:'\u203bLINE integration settings must be completed to enable this feature.'},rows:[{type:"text",slug:"button_text",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"buttonText",defaultJa:"LINE\u3067\u518d\u5165\u8377\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b",defaultEn:"Get LINE restock notifications"},{type:"text",slug:"registered_button_text",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u30dc\u30bf\u30f3\u30c6\u30ad\u30b9\u30c8",nameEn:"Registered button text",defaultJa:"LINE\u767b\u9332\u6e08\u307f",defaultEn:"LINE registered"},{type:"range",slug:"button_width",nameJa:"\u30dc\u30bf\u30f3\u306e\u5e45",nameEn:"buttonWidth",default:240,min:50,max:600,step:10},{type:"range",slug:"button_height",nameJa:"\u30dc\u30bf\u30f3\u306e\u9ad8\u3055",nameEn:"buttonHeight",default:50,min:30,max:100,step:5},{type:"colorpicker",slug:"button_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272",nameEn:"buttonColor",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"buttonBackgroundColor",default:"#ffffff"},{type:"colorpicker",slug:"button_border_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u8272",nameEn:"buttonBorderColor",default:"#000000"},{type:"colorpicker",slug:"registered_button_color",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u6587\u5b57\u8272",nameEn:"Registered text color",default:"#047857"},{type:"colorpicker",slug:"registered_button_background_color",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u80cc\u666f\u8272",nameEn:"Registered background color",default:"#ecfdf5"},{type:"colorpicker",slug:"registered_button_border_color",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u67a0\u7dda\u8272",nameEn:"Registered border color",default:"#a7f3d0"},{type:"colorpicker",slug:"button_hover_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"buttonHoverColor",default:"#222222"},{type:"colorpicker",slug:"button_hover_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"buttonHoverBackgroundColor",default:"#dddddd"},{type:"colorpicker",slug:"button_hover_border_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"buttonHoverBorderColor",default:"#222222"},{type:"range",slug:"button_radius",nameJa:"\u30dc\u30bf\u30f3\u306e\u4e38\u307f",nameEn:"buttonRadius",default:0,min:0,max:20,step:1},{type:"range",slug:"button_border_width",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u592a\u3055",nameEn:"buttonBorderWidth",default:0,min:0,max:5,step:1},{type:"fontpicker",slug:"button_font",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8",nameEn:"buttonFont",default:"helvetica_n4"},{type:"range",slug:"button_fontsize",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba",nameEn:"buttonFontSize",default:16,min:10,max:30,step:1},{type:"range",slug:"button_fontweight",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8\u30a6\u30a7\u30a4\u30c8",nameEn:"buttonFontWeight",default:400,min:100,max:900,step:100},{type:"range",slug:"button_speed",nameJa:"\u30dc\u30bf\u30f3\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u901f\u5ea6",nameEn:"buttonSpeed",default:.3,min:0,max:1,step:.1},{type:"range",slug:"registered_button_opacity",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u900f\u660e\u5ea6",nameEn:"Registered opacity",default:.55,min:.3,max:1,step:.05},{type:"select",slug:"align",nameJa:"\u30dc\u30bf\u30f3\u306e\u914d\u7f6e",nameEn:"align",default:"center",defaultJa:"\u4e2d\u592e\u5bc4\u305b",defaultEn:"Center",selectOptionsJa:[{value:"left",label:"\u5de6\u5bc4\u305b"},{value:"center",label:"\u4e2d\u592e\u5bc4\u305b"},{value:"right",label:"\u53f3\u5bc4\u305b"}],selectOptionsEn:[{value:"left",label:"Align left"},{value:"center",label:"Align center"},{value:"right",label:"Align right"}]}]}},824(e,t){t.schema=void 0;const o=e=>String(null!=e?e:"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),n=e=>"string"==typeof e&&""!==e.trim()&&"undefined"!==e,i=(e,t,o)=>n(null==e?void 0:e[t])?e[t]:o,r=(e,t,o)=>{const i=null==e?void 0:e[t];return n(i)&&/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(i)?i:o},s=(e,t,o,n,i)=>{const r=null==e?void 0:e[t],s="number"==typeof r?r:Number.parseFloat(r);return Number.isFinite(s)?Math.min(i,Math.max(n,s)):o};t.schema={preview:(e,t)=>{const n="ja"===t?{title:"\u30ed\u30b0\u30a4\u30f3\u304c\u5fc5\u8981\u3067\u3059",description:"\u518d\u5165\u8377\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b\u306b\u306f\u30ed\u30b0\u30a4\u30f3\u304c\u5fc5\u8981\u3067\u3059\u3002",login:"\u30ed\u30b0\u30a4\u30f3",cancel:"\u30ad\u30e3\u30f3\u30bb\u30eb"}:{title:"Login required",description:"Please log in to receive restock notifications.",login:"Login",cancel:"Cancel"},a=o(i(e,"login_required_modal_title",n.title)),l=o(i(e,"login_required_modal_description",n.description)),c=o(i(e,"login_required_modal_login_button_text",n.login)),d=o(i(e,"login_required_modal_cancel_button_text",n.cancel)),u=r(e,"login_required_modal_background_color","#ffffff"),h=r(e,"login_required_modal_text_color","#111111"),m=r(e,"login_required_modal_overlay_color","#000000"),p=s(e,"login_required_modal_overlay_opacity",55,0,90),g=s(e,"login_required_modal_radius",2,0,24),f=s(e,"login_required_modal_width",576,320,720),_=r(e,"login_required_modal_login_button_background_color","#000000"),v=r(e,"login_required_modal_login_button_text_color","#ffffff"),b=r(e,"login_required_modal_cancel_button_background_color","#ffffff"),y=r(e,"login_required_modal_cancel_button_text_color","#111111"),k=r(e,"login_required_modal_cancel_button_border_color","#111111"),w=s(e,"login_required_modal_button_radius",32,0,40);return`\n \n \n `},rows:[{type:"checkbox",slug:"require_login_for_restock",nameJa:"\u518d\u5165\u8377\u901a\u77e5\u306e\u5229\u7528\u3092\u4f1a\u54e1\u9650\u5b9a\u306b\u3059\u308b",nameEn:"Require sign-in for restock notifications",descriptionJa:"ON\u306b\u3059\u308b\u3068\u3001\u672a\u30ed\u30b0\u30a4\u30f3\u30e6\u30fc\u30b6\u30fc\u306f\u30e1\u30fc\u30eb\u5165\u529b\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u3067\u306f\u306a\u304f\u30ed\u30b0\u30a4\u30f3\u6848\u5185\u306b\u9032\u307f\u307e\u3059\u3002OFF\u306e\u5834\u5408\u306f\u5f93\u6765\u3069\u304a\u308a\u30b2\u30b9\u30c8\u306e\u30e1\u30fc\u30eb\u5165\u529b\u3067\u767b\u9332\u3067\u304d\u307e\u3059\u3002",descriptionEn:"When enabled, guests see the login prompt instead of the email input popup. When disabled, the existing guest email flow remains unchanged.",default:!1,fullsize:!0},{type:"checkbox",slug:"auto_register_after_login",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5f8c\u306b\u518d\u5165\u8377\u901a\u77e5\u3092\u81ea\u52d5\u767b\u9332\u3059\u308b",nameEn:"Automatically register restock notification after sign-in",descriptionJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u304cON\u306e\u3068\u304d\u3060\u3051\u6709\u52b9\u3067\u3059\u3002\u30ed\u30b0\u30a4\u30f3\u307e\u305f\u306f\u4f1a\u54e1\u767b\u9332\u5f8c\u306b\u5546\u54c1\u30da\u30fc\u30b8\u3078\u623b\u3063\u305f\u969b\u3001\u9867\u5ba2\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3067\u30e1\u30fc\u30eb\u518d\u5165\u8377\u901a\u77e5\u3092\u81ea\u52d5\u767b\u9332\u3057\u307e\u3059\u3002\u30e1\u30fc\u30eb\u304c\u53d6\u5f97\u3067\u304d\u306a\u3044\u5834\u5408\u306f\u81ea\u52d5\u767b\u9332\u305b\u305a\u3001\u518d\u64cd\u4f5c\u304c\u5fc5\u8981\u306a\u72b6\u614b\u306b\u3057\u307e\u3059\u3002",descriptionEn:"Only applies when sign-in is required. After sign-in or account creation, the customer returns to the product page and email restock is registered with their customer email. If email is unavailable, automatic registration is skipped and the customer must retry manually.",default:!1,depends:"require_login_for_restock",fullsize:!0},{type:"checkbox",slug:"one_click_when_logged_in",nameJa:"\u30ed\u30b0\u30a4\u30f3\u6e08\u307f\u9867\u5ba2\u306f\u30ef\u30f3\u30af\u30ea\u30c3\u30af\u3067\u518d\u5165\u8377\u901a\u77e5\u3092\u767b\u9332\u3059\u308b",nameEn:"Let signed-in customers register restock notifications in one click",descriptionJa:"\u30ed\u30b0\u30a4\u30f3\u6e08\u307f\u9867\u5ba2\u304c\u30e1\u30fc\u30eb\u307e\u305f\u306fLINE\u306e\u518d\u5165\u8377\u901a\u77e5\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u305f\u3068\u304d\u3001\u5165\u529b\u64cd\u4f5c\u3092\u7701\u7565\u3057\u3066\u767b\u9332\u3057\u307e\u3059\u3002\u767b\u9332\u7d50\u679c\u306f\u65e2\u5b58\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u3092\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306e\u5b8c\u4e86\u8868\u793a\u3068\u3057\u3066\u4f7f\u3044\u307e\u3059\u3002",descriptionEn:"When a signed-in customer clicks the email or LINE restock button, registration runs without asking for input. The existing popup is reused as a read-only completion view.",default:!1,fullsize:!0},{type:"checkbox",slug:"show_registered_status_when_logged_in",nameJa:"\u30ed\u30b0\u30a4\u30f3\u6e08\u307f\u9867\u5ba2\u306b\u518d\u5165\u8377\u901a\u77e5\u306e\u767b\u9332\u6e08\u307f\u8868\u793a\u3092\u51fa\u3059",nameEn:"Show registered state to signed-in customers",descriptionJa:"\u30ed\u30b0\u30a4\u30f3\u6e08\u307f\u9867\u5ba2\u3060\u3051\u304c\u5bfe\u8c61\u3067\u3059\u3002active\u306a\u30e1\u30fc\u30eb\u307e\u305f\u306fLINE\u518d\u5165\u8377\u901a\u77e5\u304c\u3042\u308b\u5834\u5408\u3001\u5546\u54c1\u8a73\u7d30\u30da\u30fc\u30b8\u306e\u30dc\u30bf\u30f3\u3092\u767b\u9332\u6e08\u307f\u8868\u793a\u306b\u5207\u308a\u66ff\u3048\u307e\u3059\u3002\u5546\u54c1\u8868\u793a\u6642\u3068\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u5207\u308a\u66ff\u3048\u6642\u306b\u72b6\u614b\u78ba\u8a8dAPI\u3092\u4f7f\u3044\u307e\u3059\u3002",descriptionEn:"Only applies to signed-in customers. When an active email or LINE restock notification exists, the product page button switches to its registered state. This uses the status API on page load and variant changes.",default:!1,fullsize:!0},{type:"text",slug:"guest_redirect_url",nameJa:"\u30b2\u30b9\u30c8\u304c\u518d\u5165\u8377\u901a\u77e5\u3092\u62bc\u3057\u305f\u5834\u5408\u306e\u9077\u79fb\u5148URL\u3000\u203b\u7a7a\u6b04\u306e\u5834\u5408\u30ed\u30b0\u30a4\u30f3\u753b\u9762\u306b\u9077\u79fb\u3057\u307e\u3059",nameEn:"URL to redirect to when a guest clicks the restock notification button. If left blank, the login screen will be displayed.",descriptionJa:"\u672a\u6307\u5b9a\u306e\u5834\u5408\u306f\u30b9\u30c8\u30a2\u306e\u30ed\u30b0\u30a4\u30f3URL\u3001\u53d6\u5f97\u3067\u304d\u306a\u3044\u5834\u5408\u306f /account/login \u306b\u9077\u79fb\u3057\u307e\u3059\u3002\u5546\u54c1\u30da\u30fc\u30b8\u3078\u623b\u308b\u305f\u3081\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u81ea\u52d5\u3067\u4ed8\u4e0e\u3057\u307e\u3059\u3002",descriptionEn:"If blank, the storefront login URL is used, falling back to /account/login. The return parameter for the product page is added automatically.",defaultJa:"",defaultEn:"",depends:"require_login_for_restock",fullsize:!0},{type:"text",slug:"login_required_modal_title",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30bf\u30a4\u30c8\u30eb",nameEn:"Login required popup title",defaultJa:"\u30ed\u30b0\u30a4\u30f3\u304c\u5fc5\u8981\u3067\u3059",defaultEn:"Login required",depends:"require_login_for_restock",showWithPreview:!0},{type:"text",slug:"login_required_modal_description",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u672c\u6587",nameEn:"Login required popup description",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b\u306b\u306f\u30ed\u30b0\u30a4\u30f3\u304c\u5fc5\u8981\u3067\u3059\u3002",defaultEn:"Please log in to receive restock notifications.",depends:"require_login_for_restock",showWithPreview:!0},{type:"text",slug:"login_required_modal_login_button_text",nameJa:"\u30ed\u30b0\u30a4\u30f3\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Login button text",defaultJa:"\u30ed\u30b0\u30a4\u30f3",defaultEn:"Login",depends:"require_login_for_restock",showWithPreview:!0},{type:"text",slug:"login_required_modal_cancel_button_text",nameJa:"\u30ad\u30e3\u30f3\u30bb\u30eb\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Cancel button text",defaultJa:"\u30ad\u30e3\u30f3\u30bb\u30eb",defaultEn:"Cancel",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_background_color",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u80cc\u666f\u8272",nameEn:"Login required popup background color",default:"#ffffff",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_text_color",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u6587\u5b57\u8272",nameEn:"Login required popup text color",default:"#111111",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_overlay_color",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u80cc\u666f\u30aa\u30fc\u30d0\u30fc\u30ec\u30a4\u8272",nameEn:"Login required popup overlay color",default:"#000000",depends:"require_login_for_restock",showWithPreview:!0},{type:"range",slug:"login_required_modal_overlay_opacity",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u80cc\u666f\u30aa\u30fc\u30d0\u30fc\u30ec\u30a4\u6fc3\u5ea6",nameEn:"Login required popup overlay opacity",default:55,min:0,max:90,step:5,depends:"require_login_for_restock",showWithPreview:!0},{type:"range",slug:"login_required_modal_radius",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u89d2\u4e38",nameEn:"Login required popup border radius",default:2,min:0,max:24,step:1,depends:"require_login_for_restock",showWithPreview:!0},{type:"range",slug:"login_required_modal_width",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u5e45",nameEn:"Login required popup width",default:576,min:320,max:720,step:8,depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_login_button_background_color",nameJa:"\u30ed\u30b0\u30a4\u30f3\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"Login button background color",default:"#000000",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_login_button_text_color",nameJa:"\u30ed\u30b0\u30a4\u30f3\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272",nameEn:"Login button text color",default:"#ffffff",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_cancel_button_background_color",nameJa:"\u30ad\u30e3\u30f3\u30bb\u30eb\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"Cancel button background color",default:"#ffffff",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_cancel_button_text_color",nameJa:"\u30ad\u30e3\u30f3\u30bb\u30eb\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272",nameEn:"Cancel button text color",default:"#111111",depends:"require_login_for_restock",showWithPreview:!0},{type:"colorpicker",slug:"login_required_modal_cancel_button_border_color",nameJa:"\u30ad\u30e3\u30f3\u30bb\u30eb\u30dc\u30bf\u30f3\u306e\u67a0\u7dda\u8272",nameEn:"Cancel button border color",default:"#111111",depends:"require_login_for_restock",showWithPreview:!0},{type:"range",slug:"login_required_modal_button_radius",nameJa:"\u30ed\u30b0\u30a4\u30f3\u5fc5\u9808\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30dc\u30bf\u30f3\u89d2\u4e38",nameEn:"Login required popup button border radius",default:32,min:0,max:40,step:1,depends:"require_login_for_restock",showWithPreview:!0},{type:"card",slug:"allowFavorite",nameJa:"\u9867\u5ba2\u304c\u304a\u6c17\u306b\u5165\u308a\u3057\u305f\u5546\u54c1\u3082\u518d\u5165\u8377\u901a\u77e5\u3057\u307e\u3059\u304b\uff1f",nameEn:"Do you want to notify customers of restocked items that they have favorited?",default:"no",selectOptionsJa:[{value:"no",label:"\u304a\u6c17\u306b\u5165\u308a\u5546\u54c1\u306e\u518d\u5165\u8377\u901a\u77e5\u306f\u3057\u306a\u3044"},{value:"yes",label:"\u304a\u6c17\u306b\u5165\u308a\u5546\u54c1\u3082\u518d\u5165\u8377\u901a\u77e5\u3059\u308b"}],selectOptionsEn:[{value:"no",label:"Do not notify for favorited items"},{value:"yes",label:"Also notify for favorited items"}]},{type:"card",slug:"limitPolicy",nameJa:"\u9001\u4fe1\u5236\u9650\u65b9\u6cd5",nameEn:"Limit policy",default:"nolimit",descriptionJa:"\u518d\u5165\u8377\u901a\u77e5\u306e\u9001\u4fe1\u6570\u3001\u9001\u4fe1\u9593\u9694\u3092\u5236\u9650\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002",descriptionEn:"You can limit the number of restock notifications and the interval between them.",selectOptionsJa:[{value:"strict",label:"\u9001\u4fe1\u6570\u3092\u5236\u9650\u3059\u308b",description:"\u518d\u5165\u8377\u901a\u77e5\u306e\u9001\u4fe1\u6570\u3092\u6307\u5b9a\u306e\u6570\u91cf\uff08\u56fa\u5b9a\u5024\u304b\u5728\u5eab\u6570\u306b\u5bfe\u3059\u308b\u5272\u5408\u3092\u9078\u629e\u53ef\uff09\u3067\u5236\u9650\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002"},{value:"interval",label:"\u9001\u4fe1\u6570\u3001\u9001\u4fe1\u9593\u9694\u3092\u5236\u9650\u3059\u308b",description:"\u6307\u5b9a\u6570\u91cf(1\u9001\u4fe1\u6bce\u306e\u9001\u4ed8\u6570)\u3092\u6307\u5b9a\u9593\u9694\uff08\u65e5\u3001\u6642\u9593\u5358\u4f4d\uff09\u3067\u9001\u4fe1\u3057\u7d9a\u3051\u307e\u3059\u3002\u5728\u5eab\u304c\u8a2d\u5b9a\u3055\u308c\u305f\u5728\u5eab\u6570\u3092\u3057\u305f\u307e\u308f\u308b\u304b\u3001\u518d\u5165\u8377\u901a\u77e5\u767b\u9332\u8005\u5168\u54e1\u306b\u9001\u4fe1\u3057\u7d42\u308f\u308b\u3068\u51e6\u7406\u3092\u7d42\u4e86\u3057\u307e\u3059\u3002"},{value:"nolimit",label:"\u5236\u9650\u3057\u306a\u3044",description:"\u6570\u91cf\u3001\u9593\u9694\u3092\u6307\u5b9a\u305b\u305a\u3001\u518d\u5165\u8377\u901a\u77e5\u767b\u9332\u8005\u5168\u54e1\u306b\u9001\u4fe1\u3057\u307e\u3059\u30021\u5ea6\u306b\u9001\u4fe1\u3067\u304d\u308b\u91cf\u306f5000\u4ef6\u7a0b\u5ea6\u3067\u305d\u308c\u3092\u8d85\u3048\u308b\u767b\u9332\u6570\u306e\u5834\u5408\u8907\u6570\u56de\u306b\u5206\u3051\u3066\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002"}],selectOptionsEn:[{value:"strict",label:"Limit the number of notifications",description:"You can limit the number of restock notifications by a specified quantity (either a fixed value or a percentage of stock)."},{value:"interval",label:"Limit the number and interval of notifications",description:"Continue sending at a specified quantity (per send) at specified intervals (days or hours). The process ends when the stock falls below the set amount or all registrants have been notified."},{value:"nolimit",label:"No limit",description:"Send to all registrants without specifying quantity or interval. If the number exceeds about 5000, it will be sent in multiple batches."}]},{type:"card",slug:"limitBasis",nameJa:"\u9001\u4fe1\u6570\u8a08\u7b97\u65b9\u6cd5",nameEn:"Limit calculation method",default:"static",selectOptionsJa:[{value:"static",label:"\u56fa\u5b9a\u5024"},{value:"stock_amount",label:"\u5728\u5eab\u6570\xd7\u25cb\u25cb\uff05\u4ef6\u9001\u4fe1\u3059\u308b\uff081\u56de\u306e\u9001\u4fe1\u6570\uff09\u3000"}],selectOptionsEn:[{value:"static",label:"Fixed value"},{value:"stock_amount",label:"Send as a percentage of stock per batch"}],checkVisible:e=>"nolimit"!==e.limitPolicy},{type:"number",slug:"limitAmount",nameJa:"1\u56de\u306e\u9001\u4fe1\u6570 \u307e\u305f\u306f \u5728\u5eab\u6570\u306b\u304b\u3051\u308b\u30d1\u30fc\u30bb\u30f3\u30c8",nameEn:"Limit amount or percentage of stock",default:100,min:0,max:1e3,step:1,checkVisible:e=>"nolimit"!==e.limitPolicy&&"nolimit"!==e.limitBasis,customize:(e,t)=>Object.assign(Object.assign({},t),{nameJa:"stock_amount"===e.limitBasis?"\u5728\u5eab\u6570\xd7\u30d1\u30fc\u30bb\u30f3\u30c8\u4ef6\u9001\u308b":"1\u56de\u306e\u9001\u4fe1\u6570",nameEn:"stock_amount"===e.limitBasis?"Percentage of stock":"Limit amount"})},{type:"interval",slug:"interval",nameJa:"\u9001\u4fe1\u9593\u9694",nameEn:"Sending interval",default:{count:1,term:"day"},checkVisible:e=>"strict"!==e.limitPolicy&&"nolimit"!==e.limitPolicy},{type:"card",slug:"sendingOrder",nameJa:"\u9001\u4fe1\u9806\u5e8f",nameEn:"Sending order",default:"requested",selectOptionsJa:[{value:"requested",label:"\u30ea\u30af\u30a8\u30b9\u30c8\u9806(\u53e4\u3044\u9806)",description:"\u518d\u5165\u8377\u901a\u77e5\u767b\u9332\u3092\u3057\u305f\u9806\uff08\u767b\u9332\u3057\u305f\u65e5\u6642\u304c\u53e4\u3044\u9806\uff09\u306b\u9001\u4fe1\u3057\u307e\u3059\u3002"},{value:"requestedDesc",label:"\u30ea\u30af\u30a8\u30b9\u30c8\u9006\u9806(\u65b0\u3057\u3044\u9806)",description:"\u518d\u5165\u8377\u901a\u77e5\u767b\u9332\u3092\u3057\u305f\u9006\u9806\uff08\u767b\u9332\u3057\u305f\u65e5\u6642\u304c\u65b0\u3057\u3044\u9806\uff09\u306b\u9001\u4fe1\u3057\u307e\u3059\u3002"}],selectOptionsEn:[{value:"requested",label:"Order of request (oldest first)",description:"Send in the order of registration (oldest registration date first)."},{value:"requestedDesc",label:"Reverse order of request (newest first)",description:"Send in the reverse order of registration (newest registration date first)."}]},{type:"card",slug:"sendingOrderPreferType",nameJa:"\u30ea\u30d4\u30fc\u30bf\u30fc\u306e\u9001\u4fe1\u9806\u5e8f",nameEn:"Sending order of repeaters",default:"none",selectOptionsJa:[{value:"repeater",label:"\u30ea\u30d4\u30fc\u30bf\u30fc\u3092\u512a\u5148",description:"\u518d\u5165\u8377\u901a\u77e5\u767b\u9332\u3092\u3057\u305f\u9867\u5ba2\u306e\u4e2d\u3067\u30ea\u30d4\u30fc\u30bf\u30fc\uff08\u904e\u53bb\u8cfc\u5165\u3057\u305f\u3053\u3068\u304c\u3042\u308b\u9867\u5ba2\uff09\u304b\u3089\u512a\u5148\u3057\u3066\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002\u30ea\u30d4\u30fc\u30bf\u30fc\u5185\u3001\u672a\u8cfc\u5165\u8005\u5185\u3067\u306e\u9001\u4fe1\u9806\u756a\u306f\u3001\u9001\u4fe1\u9806\u5e8f\u306e\u8a2d\u5b9a\u306b\u57fa\u3065\u3044\u3066\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002"},{value:"nonbuyer",label:"\u672a\u8cfc\u5165\u8005\u3092\u512a\u5148",description:"\u518d\u5165\u8377\u901a\u77e5\u767b\u9332\u3092\u3057\u305f\u9867\u5ba2\u306e\u4e2d\u3067\u672a\u8cfc\u5165\u8005\u5185\u304b\u3089\u512a\u5148\u3057\u3066\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002\u672a\u8cfc\u5165\u8005\u5185\u3001\u30ea\u30d4\u30fc\u30bf\u30fc\u5185\uff08\u904e\u53bb\u8cfc\u5165\u3057\u305f\u3053\u3068\u304c\u3042\u308b\u9867\u5ba2\uff09\u3067\u306e\u9001\u4fe1\u9806\u756a\u306f\u3001\u9001\u4fe1\u9806\u5e8f\u306e\u8a2d\u5b9a\u306b\u57fa\u3065\u3044\u3066\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002"},{value:"none",label:"\u30ea\u30d4\u30fc\u30bf\u30fc\u30fb\u672a\u8cfc\u5165\u8005\u3069\u3061\u3089\u3082\u512a\u5148\u3057\u306a\u3044",description:"\u30ea\u30d4\u30fc\u30bf\u30fc\u306b\u57fa\u3065\u304f\u9001\u4fe1\u9806\u756a\u8a2d\u5b9a\u3092\u7121\u52b9\u306b\u3057\u307e\u3059\u3002\u3053\u306e\u5834\u5408\u3001\u30ea\u30d4\u30fc\u30bf\u30fc\u3001\u672a\u8cfc\u5165\u8005\u554f\u308f\u305a\u9001\u4ed8\u9806\u5e8f\u306e\u8a2d\u5b9a\u306b\u57fa\u3065\u3044\u3066\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002"}],selectOptionsEn:[{value:"repeater",label:"Prioritize repeaters",description:"Prioritize customers who have purchased before. Within repeaters and non-buyers, the sending order is based on the sending order setting."},{value:"nonbuyer",label:"Prioritize non-buyers",description:"Prioritize non-buyers among registrants. Within non-buyers and repeaters, the sending order is based on the sending order setting."},{value:"none",label:"Do not prioritize either",description:"Disable sending order based on repeaters. In this case, the sending order setting applies regardless of repeater status."}]},{type:"card",slug:"resendPolicy",nameJa:"\u518d\u9001\u4fe1\u30dd\u30ea\u30b7\u30fc(\u518d\u5165\u8377\u901a\u77e5\u53ca\u3073\u304a\u6c17\u306b\u5165\u308a)",nameEn:"Resend policy",default:"none",selectOptionsJa:[{value:"none",label:"\u518d\u9001\u4fe1\u3057\u306a\u3044(1\u5ea6\u3057\u304b\u9001\u3089\u306a\u3044)",description:"\u4e00\u5ea6\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u3063\u3066\u3044\u308b\u9867\u5ba2\u306e\u5834\u5408\u3001\u518d\u5ea6\u540c\u3058\u5546\u54c1\u3001\u540c\u3058\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3092\u518d\u5165\u8377\u3057\u305f\u969b\u306f\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3057\u307e\u305b\u3093\u3002"},{value:"always",label:"\u5e38\u306b\u518d\u9001\u4fe1\u3059\u308b",description:"\u4e00\u5ea6\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u3063\u305f\u9867\u5ba2\u3067\u3082\u3001\u518d\u5ea6\u540c\u3058\u5546\u54c1\u3001\u540c\u3058\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3092\u518d\u5165\u8377\u3057\u305f\u5834\u5408\u306b\u4f55\u5ea6\u3067\u3082\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3057\u307e\u3059\u3002\u52d5\u4f5c\u78ba\u8a8d\u7b49\u691c\u8a3c\u306e\u969b\u306b\u3054\u5229\u7528\u304f\u3060\u3055\u3044\u3002"},{value:"interval",label:"\u6307\u5b9a\u306e\u9593\u9694\u3067\u518d\u9001\u4fe1\u3059\u308b",description:"\u4e00\u5ea6\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u3063\u305f\u9867\u5ba2\u3067\u3082\u8a2d\u5b9a\u3057\u305f\u65e5\u6570\u3001\u6642\u9593\u4ee5\u4e0a\u7d4c\u904e\u3057\u3066\u3044\u308c\u3070\u3001\u901a\u5e38\u901a\u308a\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3057\u307e\u3059\u3002\u524d\u56de\u306e\u901a\u77e5\u304b\u3089\u306e\u7d4c\u904e\u6642\u9593\u304c\u8a2d\u5b9a\u3057\u305f\u65e5\u6570\u3001\u6642\u9593\u672a\u6e80\u306e\u5834\u5408\u306f\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3057\u307e\u305b\u3093\u3002\u9593\u9694\u306f\u6642\u9593\u5358\u4f4d\u304b\u65e5\u6570\u5358\u4f4d\u3067\u6307\u5b9a\u53ef\u80fd\u3067\u3059\u3002"},{value:"24hours",label:"24\u6642\u9593\u6bce\u306b\u518d\u9001\u4fe1\u3059\u308b",description:"\u4e00\u5ea6\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u3063\u305f\u9867\u5ba2\u3067\u3082\u3001\u524d\u56de\u306e\u901a\u77e5\u304b\u308924\u6642\u9593\u4ee5\u4e0a\u7d4c\u904e\u3057\u3066\u3044\u308c\u3070\u3001\u901a\u5e38\u901a\u308a\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3057\u307e\u3059\u3002\u524d\u56de\u306e\u901a\u77e5\u304b\u3089\u306e\u7d4c\u904e\u6642\u9593\u304c24\u6642\u9593\u672a\u6e80\u306e\u5834\u5408\u306f\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3057\u307e\u305b\u3093\u3002"}],selectOptionsEn:[{value:"none",label:"Do not resend (only once)",description:"If a customer has already received a restock notification, no further notifications will be sent for the same product/variant."},{value:"always",label:"Always resend",description:"Even if a customer has already received a notification, notifications will be sent every time the same product/variant is restocked. Useful for testing."},{value:"interval",label:"Resend at specified intervals",description:"If the set number of days/hours has passed since the last notification, a new notification will be sent. Otherwise, no notification will be sent. The interval can be specified in hours or days."},{value:"24hours",label:"Resend every 24 hours",description:"If 24 hours have passed since the last notification, a new notification will be sent. Otherwise, no notification will be sent."}]},{type:"interval",slug:"resendPolicyInterval",nameJa:"\u518d\u9001\u4fe1\u9593\u9694",nameEn:"Resend interval",default:{count:1,term:"day"},checkVisible:e=>"interval"===e.resendPolicy},{type:"number",slug:"restockMinimumStock",nameJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u9001\u4fe1\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u5728\u5eab\u6570",nameEn:"Minimum stock for restock notification",descriptionJa:"\u518d\u5165\u8377\u901a\u77e5\u51e6\u7406\u304c\u52d5\u4f5c\u3059\u308b\u305f\u3081\u306e\u6700\u4f4e\u5728\u5eab\u6570\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u4f8b\u3048\u30705\u3067\u8a2d\u5b9a\u3059\u308b\u3068\u3001\u5728\u5eab\u6570\u304c5\u672a\u6e80\u306e\u72b6\u614b\u304b\u3089\u30015\u4ee5\u4e0a\u306b\u5897\u3048\u305f\u5834\u5408\u306b\u518d\u5165\u8377\u901a\u77e5\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002",descriptionEn:"Set the minimum stock required for the restock notification process to operate. For example, if you set it to 5, the restock notification process will be executed when the stock quantity increases from less than 5 to 5 or more.",default:1,min:1,max:1e3,step:1},{type:"card",slug:"favoriteVariantPolicy",nameJa:"\u304a\u6c17\u306b\u5165\u308a\u304b\u3089\u306e\u518d\u5165\u8377\u901a\u77e5\u306e\u91cd\u8907\u9001\u4fe1\u8a2d\u5b9a",nameEn:"Variation rule for restock notification from favorites",default:"always",selectOptionsJa:[{value:"always",label:"\u5e38\u306b\u9001\u4fe1\u3059\u308b",description:"\u304a\u6c17\u306b\u5165\u308a\u767b\u9332\u3092\u3057\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u5546\u54c1\u30fb\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3092\u5bfe\u8c61\u306b\u3001\u5728\u5eab\u304c\u5165\u3063\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u518d\u5165\u8377\u901a\u77e5\u304c\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002\uff08\u4f8b\uff1a\u540c\u3058\u5546\u54c1\u306eS\u30b5\u30a4\u30ba\u30fbM\u30b5\u30a4\u30ba\u4e21\u65b9\u3092\u304a\u6c17\u306b\u5165\u308a\u767b\u9332\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u305d\u308c\u305e\u308c\u5165\u5eab\u3057\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u518d\u5165\u8377\u901a\u77e5\u304c\u9001\u4fe1\u3055\u308c\u307e\u3059\uff09"},{value:"none",label:"\u9001\u4fe1\u3057\u306a\u3044",description:"\u540c\u3058\u5546\u54c1\u306e\u8907\u6570\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3092\u304a\u6c17\u306b\u5165\u308a\u767b\u9332\u3057\u3066\u304a\u308a\u3001\u3044\u305a\u308c\u304b\u306e\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3067\u518d\u5165\u8377\u901a\u77e5\u304c\u9001\u4fe1\u3055\u308c\u305f\u5834\u5408\u3001\u305d\u308c\u4ee5\u964d\u306e\u518d\u5165\u8377\u901a\u77e5\u306f\u9001\u4fe1\u3055\u308c\u307e\u305b\u3093\u3002\uff08\u4f8b\uff1a\u540c\u3058\u5546\u54c1\u306eS\u30b5\u30a4\u30ba\u30fbM\u30b5\u30a4\u30ba\u4e21\u65b9\u3092\u304a\u6c17\u306b\u5165\u308a\u767b\u9332\u3057\u3066\u3044\u308b\u5834\u5408\u3001S\u30b5\u30a4\u30ba\u306e\u5165\u5eab\u3067\u518d\u5165\u8377\u901a\u77e5\u304c\u9001\u4fe1\u3055\u308c\u308b\u3068\u3001M\u30b5\u30a4\u30ba\u304c\u5165\u5eab\u3057\u3066\u3082\u518d\u5165\u8377\u901a\u77e5\u306f\u9001\u4fe1\u3055\u308c\u307e\u305b\u3093\uff09"}],selectOptionsEn:[{value:"always",label:"Always send",description:"Even if a customer has already received a restock notification for another variation, a notification will be sent again. (e.g., S size T-shirt restocked, then M size restocked the next day)"},{value:"none",label:"Do not send",description:"If a customer has already received a restock notification for any variation, no further notifications will be sent."}]}]}},169(e,t,o){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.schema=t.RestockPopupManager=void 0;const i=n(o(132));class r{constructor(e,t=!1){this.content=null,this.title=null,this.secondTitle=null,this.popup=null,this.button=null,this.footer=null,this.secondFooter=null,this.preview=!1,this.showSecondPopup=!1,this.container=null,this.secondContainer=null,this.secondContent=null,this.close=null,this.product_id=null,this.inited=!1,this.preview=t,this.config=e,this.init()}static getInstance(e,t=!1){return r.instance?(r.instance.config=e,r.instance.preview=t):r.instance=new r(e,t),r.instance}setParent(e){this.parent=e}renderTemplate(){document&&document.body?document.body.insertAdjacentHTML("beforeend",r.template):window.setTimeout(this.renderTemplate.bind(this),100)}init(){document&&document.body?this.runInit():window.setTimeout(this.init.bind(this),100)}runInit(){this.inited=!0,this.preview||document.body.insertAdjacentHTML("beforeend",r.template),i.default.init(),this.updateElements(),this.container&&this.container.addEventListener("click",e=>{e.stopPropagation()}),this.close=this.container&&this.container.querySelectorAll(".storecrm_modal__close"),this.close&&!this.preview&&this.close.forEach(e=>{e.addEventListener("click",e=>{i.default.close("storecrm-modal")})})}updateElements(){this.popup=document.getElementById("storecrm-modal"),this.content=document.getElementById("storecrm-modal-content"),this.secondContent=document.getElementById("storecrm-modal-second-content"),this.title=document.getElementById("storecrm-modal-title"),this.secondTitle=document.getElementById("storecrm-modal-second-title"),this.footer=document.querySelector(".storecrm_modal__footer"),this.secondFooter=document.getElementById("storecrm-modal-second-footer"),this.container=document.querySelector(".storecrm_modal__container"),this.secondContainer=document.getElementById("storecrm-modal-second-popup-preview")}render(e,t,o={}){var n,i,r,s;if(this.preview&&this.updateElements(),this.showSecondPopup=e.add_accepts_marketing_checkbox&&this.preview,this.footer&&0!==this.footer.children.length&&(this.footer.innerHTML=""),this.button=null,!o.hideSubmitButton){const t=document.createElement("button");t.className="storecrm_modal__btn storecrm_modal__btn-primary",t.innerHTML=e.button_text,null===(n=this.footer)||void 0===n||n.appendChild(t),this.button=t}this.button&&!this.preview&&this.button.addEventListener("click",()=>{this.checkAcceptsMarketingStatusAndClearMessages()}),this.config=e;const a=o.email||(null===(i=window.storecrm_data)||void 0===i?void 0:i.customer_email)||window.localStorage.getItem("storecrm_restock_email")||"",l=o.readOnly?' disabled aria-disabled="true"':"",c=o.readOnly?' readonly aria-readonly="true"':"";if(this.title&&this.content&&this.popup){this.title.innerText=e.popup_title;let n=`\n
${e.popup_description}
\n
\n
${e.emailaddress}
\n${e.add_accepts_marketing_checkbox?``:""}\n${e.add_accepts_marketing_checkbox?``:""}\n
\n`.trim(),i=o.variantId||null;if(location.search&&location.search.includes("variant")){const e=new URL(location.href);i=i||e.searchParams.get("variant")}console.error("RestockPopupManager: render: variants",t,i);const r=t.filter(e=>!e.available).map(e=>``).join("");t&&Array.isArray(t)&&t.length>1?(n=n.replace("\x3c!-- select_style --\x3e",""),n=n.replace("\x3c!-- options --\x3e",r)):(n=n.replace("\x3c!-- select_style --\x3e","display:none"),n=n.replace("\x3c!-- options --\x3e",r)),this.content.innerHTML=n,this.content.style.color=e.text_color,this.container&&(this.container.style.backgroundColor=e.background_color,this.container.style.borderRadius=`${e.button_radius}px`,this.container.style.width="100%"),this.button&&(this.button.style.backgroundColor=e.button_background_color,this.button.style.color=e.button_text_color),this.close&&this.close.forEach(t=>{t.style.color=e.close_text_color})}if(this.resetMessage(),this.showSecondPopup&&this.secondTitle&&this.secondContent&&this.secondContainer){this.secondContainer.style.display="block",this.secondTitle.innerText=e.popup_title;let t="";t=`\n
${e.email_confirmation_text}
hogehoge@hoge.com
\n
`,this.secondContent.innerHTML=t,this.secondContent.style.color=e.text_color,this.secondContainer.style.backgroundColor=e.background_color,this.secondContainer.style.borderRadius=`${e.button_radius}px`,this.secondContainer.style.marginTop="20px",this.secondContainer.style.width="100%",this.secondFooter&&0!==this.secondFooter.children.length&&(this.secondFooter.innerHTML="");const o=document.createElement("button");o.className="storecrm_modal__btn storecrm_modal__btn-primary",o.innerHTML=e.button_text,o.style.backgroundColor=e.button_background_color,o.style.color=e.button_text_color,null===(r=this.secondFooter)||void 0===r||r.appendChild(o)}else this.secondContainer&&(this.secondContainer.style.display="none");this.preview||null===(s=document.getElementById("storecrm-modal-second-popup-preview"))||void 0===s||s.remove(),this.preview&&(this.success(this.config.success_text),this.failure(this.config.error_text),this.popup&&this.popup.querySelectorAll(".storecrm_modal__overlay,.storecrm_modal__close").forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation()})}))}resetMessage(){var e,t;this.footer&&(null===(e=this.footer)||void 0===e||e.querySelectorAll(".storecrm_modal_message").forEach(e=>e.remove())),this.preview&&this.secondFooter&&(null===(t=this.secondFooter)||void 0===t||t.querySelectorAll(".storecrm_modal_message").forEach(e=>e.remove()))}disableButton(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.innerText="Sending...")}enableButtion(){this.button&&(this.button.removeAttribute("disabled"),this.button.innerText=this.config.button_text||"Enable Restock Notification")}submit(e=!1){var t,o,n;if(this.preview)return;this.resetMessage(),this.disableButton();const i=null===(t=this.content)||void 0===t?void 0:t.querySelector("#storecrm_restock_email"),r=null===(o=this.content)||void 0===o?void 0:o.querySelector("#storecrm_restock_variant"),s=null===(n=this.content)||void 0===n?void 0:n.querySelector("#storecrm_restock_accepts_marketing"),a=i?i.value:"",l=r?r.value:"",c=this.product_id,d=s?s.checked:null;this.parent&&this.parent.storeRestock(a,l,c,d,this.config.add_accepts_marketing_checkbox,e,this.success.bind(this),this.failure.bind(this))}show(e,t,o,n={}){this.product_id=o,this.inited?this.runShow(e,t,n):window.setTimeout(()=>this.show(e,t,o,n),100)}runShow(e,t,o={}){this.render(e,t,o);if(document.getElementById("storecrm-modal"))try{i.default.show("storecrm-modal")}catch(e){console.warn("StoreCRM: MicroModal show failed",e)}else console.warn("StoreCRM: restock popup modal element not found, skip show")}hide(){if(document.getElementById("storecrm-modal"))try{i.default.close("storecrm-modal")}catch(e){console.warn("StoreCRM: MicroModal close failed",e)}}success(e){this.enableButtion();const t=document.createElement("div");t.classList.add("storecrm_modal_success","storecrm_modal_message"),t.style.color=this.config.success_text_color,t.style.backgroundColor=this.config.success_background_color,t.innerText=e,this.showSecondPopup?this.secondFooter&&this.secondFooter.appendChild(t):this.footer&&this.footer.appendChild(t)}failure(e){this.enableButtion();const t=document.createElement("div");t.classList.add("storecrm_modal_error","storecrm_modal_message"),t.style.color=this.config.failure_text_color,t.style.backgroundColor=this.config.failure_background_color,t.innerText=e,this.showSecondPopup?this.secondFooter&&this.secondFooter.appendChild(t):this.footer&&this.footer.appendChild(t)}checkAcceptsMarketingStatusAndClearMessages(){var e;if(this.resetMessage(),!this.config.add_accepts_marketing_checkbox)return void this.submit(!1);const t=null===(e=this.content)||void 0===e?void 0:e.querySelector("#storecrm_restock_email");this.parent.doMailCheck(t.value,this.failure.bind(this)).then(e=>{e.email?e.accepts_marketing?this.submit(!1):this.showAcceptsMarketingCheckbox(!1):this.showAcceptsMarketingCheckbox(!0)})}showAcceptsMarketingCheckbox(e){var t;const o=document.getElementById("storecrm-modal-content"),n=null===(t=this.content)||void 0===t?void 0:t.querySelector("#storecrm_restock_email"),i=document.getElementById("accepts_marketing_checkbox_container"),r=document.getElementById("email_confirmation_container");if(!o||!i||!r)return;r.innerHTML=this.config.email_confirmation_text+"
"+n.value;const s=Array.from(o.children);s.forEach(e=>{"none"!==e.style.display&&e.classList.add("fade-out")}),setTimeout(()=>{s.forEach(e=>{e.style.display="none"})},300),i.classList.add("fade-in"),setTimeout(()=>{i.style.display="block"},300),r.classList.add("fade-in"),setTimeout(()=>{r.style.display="block"},300),this.switchSubmitButton(e)}switchSubmitButton(e){var t;this.footer&&(this.footer.innerHTML="");const o=document.createElement("button");o.className="storecrm_modal__btn storecrm_modal__btn-primary",o.style.color=this.config.button_text_color,o.style.backgroundColor=this.config.button_background_color,o.innerHTML=this.config.button_text,this.footer&&this.footer.appendChild(o),this.button=o,null===(t=this.button)||void 0===t||t.addEventListener("click",()=>{this.submit(e)})}}t.RestockPopupManager=r,r.template='';let s=null;t.schema={preview:(e,t)=>{var o,n;return o=()=>{r.getInstance(e,!0).show(e,[],"1234567890")},n=300,clearTimeout(s),s=setTimeout(o,n),r.template},rows:[{type:"text",slug:"popup_title",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30bf\u30a4\u30c8\u30eb",nameEn:"Popup title",defaultJa:"\u518d\u5165\u8377\u901a\u77e5",defaultEn:"Restock Notification"},{type:"text",slug:"popup_description",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u672c\u6587",nameEn:"Popup description",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u3054\u5e0c\u671b\u306e\u65b9\u306f\u4ee5\u4e0b\u304b\u3089\u3001\u3054\u9078\u629e\u304f\u3060\u3055\u3044\u3002",defaultEn:"If you would like to receive a restock notification, please select from below."},{type:"text",slug:"emailaddress",nameJa:"\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u30d5\u30a9\u30fc\u30e0\u540d",nameEn:"Email address form name",defaultJa:"\u3054\u9023\u7d61\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9",defaultEn:"Contact Email Address"},{type:"colorpicker",slug:"background_color",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u80cc\u666f\u8272",nameEn:"Popup background color",default:"#ffffff"},{type:"colorpicker",slug:"text_color",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u8272",nameEn:"Popup text color",default:"#000000"},{type:"colorpicker",slug:"close_text_color",nameJa:"\u9589\u3058\u308b\u30dc\u30bf\u30f3\u306e\u8272",nameEn:"Popup close button text color",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"buttonHoverColor",default:"#222222"},{type:"colorpicker",slug:"button_text_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8\u30ab\u30e9\u30fc",nameEn:"buttonHoverBackgroundColor",default:"#dddddd"},{type:"text",slug:"button_text",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"buttonText",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u6709\u52b9\u306b\u3059\u308b",defaultEn:"Enable restock notification"},{type:"text",slug:"success_text",nameJa:"\u6210\u529f\u6642\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Success text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u304c\u767b\u9332\u3055\u308c\u307e\u3057\u305f\u3002",defaultEn:"Restock notification has been registered."},{type:"colorpicker",slug:"success_background_color",nameJa:"\u6210\u529f\u6642\u306e\u80cc\u666f\u8272",nameEn:"Success background color",default:"#F0FDF4"},{type:"colorpicker",slug:"success_text_color",nameJa:"\u6210\u529f\u6642\u306e\u6587\u5b57\u8272",nameEn:"Success text color",default:"#166534"},{type:"text",slug:"error_text",nameJa:"\u5931\u6557\u6642\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Error text",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u306e\u767b\u9332\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002",defaultEn:"Failed to register restock notification. Please try again later."},{type:"text",slug:"error_text_email",nameJa:"\u5931\u6557\u6642\u306e\u30c6\u30ad\u30b9\u30c8(\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u5224\u5b9a)",nameEn:"Error text",defaultJa:"\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002\u78ba\u8a8d\u306e\u4e0a\u3001\u518d\u5ea6\u3054\u8a18\u5165\u304f\u3060\u3055\u3044\u3002",defaultEn:"The email address is incorrect. Please check and re-enter."},{type:"colorpicker",slug:"failure_background_color",nameJa:"\u30a8\u30e9\u30fc\u6642\u306e\u80cc\u666f\u8272",nameEn:"Success background color",default:"#FEF2F2"},{type:"colorpicker",slug:"failure_text_color",nameJa:"\u30a8\u30e9\u30fc\u6642\u306e\u6587\u5b57\u8272",nameEn:"Success text color",default:"#991B1B"},{type:"range",slug:"button_radius",nameJa:"\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u306e\u4e38\u307f",nameEn:"buttonRadius",default:10,min:0,max:40,step:1},{type:"checkbox",slug:"add_accepts_marketing_checkbox",nameJa:"\u30e1\u30eb\u30de\u30ac\u914d\u4fe1\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u3092\u6709\u52b9\u5316",nameEn:"Add accepts marketing checkbox",default:!1},{type:"text",slug:"accepts_marketing_checkbox_text",nameJa:"\u30e1\u30eb\u30de\u30ac\u914d\u4fe1\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"Accepts marketing checkbox text",defaultJa:"\u30e1\u30eb\u30de\u30ac\u914d\u4fe1\u306b\u540c\u610f\u3059\u308b",defaultEn:"I agree to receive marketing emails"},{type:"text",slug:"email_confirmation_text",nameJa:"\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u78ba\u8a8d\u30c6\u30ad\u30b9\u30c8",nameEn:"Email confirmation text",defaultJa:"\u3053\u3061\u3089\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3067\u9593\u9055\u3044\u306a\u3044\u3067\u3059\u304b\uff1f",defaultEn:"Is this the correct email address?"},{type:"checkbox",slug:"create_shopify_customer",nameJa:"\u30e1\u30eb\u30de\u30ac\u8cfc\u8aadON\u6642\u306bShopify\u9867\u5ba2\u3092\u4f5c\u6210\u3059\u308b",nameEn:"Create Shopify customer when marketing is subscribed",default:!1,checkVisible:e=>!0===e.add_accepts_marketing_checkbox},{type:"text",slug:"create_shopify_customer_tags",nameJa:"Shopify\u9867\u5ba2\u4f5c\u6210\u6642\u306b\u4ed8\u4e0e\u3059\u308b\u30bf\u30b0\uff08\u30ab\u30f3\u30de\u533a\u5207\u308a\uff09",nameEn:"Tags to add when creating Shopify customer (comma separated)",defaultJa:"",defaultEn:"",checkVisible:e=>!0===e.add_accepts_marketing_checkbox&&!0===e.create_shopify_customer}]}},304(e,t){t.schema=t.render=t.RestockButton=void 0;class o{constructor(e,t,o,n,i){this.eventTriggered=!1,this.variants=o,this.buttonSettings=n,this.productId=t,this.product=i}static getInstance(e,t=null,n=null,i=null,r=null){if(o.instances[e])i&&(o.instances[e].buttonSettings=i);else{if(!(t&&n&&i&&r))throw new Error("StoreCRM Restock: productId, variants, buttonSettings, product are required");o.instances[e]=new o(e,t,n,i,r)}return o.instances[e]}createScript(e,t){const o=e?"":"onclick=\"event.preventDefault();window.storecrm ? window.storecrm.showRestock(this) : alert('\u8aad\u8fbc\u4e2d\u3067\u3059\u3002\u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002');\"";return`\n\n\n
\n\n
\n `}checkRender(e){document.querySelectorAll(`.storecrm-restock-${e}`).forEach(e=>{var t;if(e instanceof HTMLElement&&e.closest('[data-type="restock-button"]')){const o=new URL(location.href),n=(null===(t=this.variants.find(e=>e.available))||void 0===t?void 0:t.id)||this.variants[0].id||null,i=parseInt(o.searchParams.get("variant")||n,10);if(!i)return void console.error("StoreCRM Restock: variantId is not set",i);if(!this.product||!this.product.tags||this.product.tags.indexOf("storecrm-restock-hidden")>=0)return console.error("StoreCRM: Restock:product not found or hidden"),void(e.style.display="none");const r=window.Shopify&&window.Shopify.designMode||this.variants.find(e=>!e.available&&e.id===i);e.style.display=r?"inline-block":"none"}})}render(e,t=!1){if(t)return this.createScript(!0,e);if(!this.eventTriggered){if(this.eventTriggered=!0,window.navigation)window.navigation.addEventListener("navigate",()=>{window.setTimeout(()=>this.checkRender(e),100)}),window.setTimeout(()=>this.checkRender(e),100),window.setTimeout(()=>this.checkRender(e),1e3);else{let t=location.href;window.setInterval(()=>{t!==location.href&&(t=location.href,this.checkRender(e))},1e3),window.setTimeout(()=>this.checkRender(e),100),window.setTimeout(()=>this.checkRender(e),1e3)}return this.createScript(!1,e)}}}t.RestockButton=o,o.instances={};t.render=({productId:e,variantId:t,variants:n,id:i,buttonSettings:r,isOutOfStock:s,product:a,preview:l=!1})=>o.getInstance(i,e,n,r,a).render(i,l);const n=e=>{const t=[`opacity: ${((e,t,o,n)=>{const i=Number(e);return Number.isFinite(i)?Math.min(n,Math.max(o,i)):t})(e.registered_button_opacity,.55,.3,1)}`,"cursor: not-allowed","pointer-events: none"];return e.registered_button_color&&t.push(`color: ${e.registered_button_color}`),e.registered_button_background_color&&t.push(`background-color: ${e.registered_button_background_color}`),e.registered_button_border_color&&t.push(`border-color: ${e.registered_button_border_color}`),t.join("; ")},i=(e,t,o)=>{const i=t.registered_button_text||("ja"===o?"\u767b\u9332\u6e08\u307f":"Registered");return`\n
\n
${"ja"===o?"\u767b\u9332\u6e08\u307f\u8868\u793a":"Registered state"}
\n ${(e||"").replace(/]*)>[\s\S]*?<\/button>/,(e,o)=>{const r=String(o||"").replace(/\sonclick="[^"]*"/g,"");return`${s=i,String(null!=s?s:"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}`;var s})}\n
`};t.schema={preview:(e,o)=>((e,t,o,n)=>`\n
\n
\n
${"ja"===n?"\u901a\u5e38\u8868\u793a":"Default state"}
\n ${e||""}\n
\n ${i(t,o,n)}\n
`)((0,t.render)({productId:"TEMP_productId",id:"TEMP_restock",buttonSettings:e,isOutOfStock:!1,preview:!0,product:{tags:[]},variants:[]}),(0,t.render)({productId:"TEMP_productId",id:"TEMP_restock_registered",buttonSettings:e,isOutOfStock:!1,preview:!0,product:{tags:[]},variants:[]}),e,o),rows:[{type:"text",slug:"button_text",nameJa:"\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8",nameEn:"buttonText",defaultJa:"\u518d\u5165\u8377\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b",defaultEn:"Notify restock"},{type:"text",slug:"registered_button_text",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u30dc\u30bf\u30f3\u30c6\u30ad\u30b9\u30c8",nameEn:"Registered button text",defaultJa:"\u767b\u9332\u6e08\u307f",defaultEn:"Registered"},{type:"range",slug:"button_width",nameJa:"\u30dc\u30bf\u30f3\u306e\u5e45",nameEn:"buttonWidth",default:200,min:50,max:600,step:10},{type:"range",slug:"button_height",nameJa:"\u30dc\u30bf\u30f3\u306e\u9ad8\u3055",nameEn:"buttonHeight",default:50,min:30,max:100,step:5},{type:"colorpicker",slug:"button_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272",nameEn:"buttonColor",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272",nameEn:"buttonBackgroundColor",default:"#ffffff"},{type:"colorpicker",slug:"button_border_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u8272",nameEn:"buttonBorderColor",default:"#000000"},{type:"colorpicker",slug:"registered_button_color",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u6587\u5b57\u8272",nameEn:"Registered text color",default:"#666666"},{type:"colorpicker",slug:"registered_button_background_color",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u80cc\u666f\u8272",nameEn:"Registered background color",default:"#f3f4f6"},{type:"colorpicker",slug:"registered_button_border_color",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u67a0\u7dda\u8272",nameEn:"Registered border color",default:"#d1d5db"},{type:"colorpicker",slug:"button_hover_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u6587\u5b57\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"buttonHoverColor",default:"#222222"},{type:"colorpicker",slug:"button_hover_background_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u80cc\u666f\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"buttonHoverBackgroundColor",default:"#dddddd"},{type:"colorpicker",slug:"button_hover_border_color",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u8272(\u30db\u30d0\u30fc\u6642)",nameEn:"buttonHoverBorderColor",default:"#222222"},{type:"range",slug:"button_radius",nameJa:"\u30dc\u30bf\u30f3\u306e\u4e38\u307f",nameEn:"buttonRadius",default:0,min:0,max:20,step:1},{type:"range",slug:"button_border_width",nameJa:"\u30dc\u30bf\u30f3\u306e\u7dda\u306e\u592a\u3055",nameEn:"buttonBorderWidth",default:0,min:0,max:5,step:1},{type:"fontpicker",slug:"button_font",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8",nameEn:"buttonFont",default:"helvetica_n4"},{type:"range",slug:"button_fontsize",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba",nameEn:"buttonFontSize",default:16,min:10,max:30,step:1},{type:"range",slug:"button_fontweight",nameJa:"\u30dc\u30bf\u30f3\u306e\u30d5\u30a9\u30f3\u30c8\u30a6\u30a7\u30a4\u30c8",nameEn:"buttonFontWeight",default:400,min:100,max:900,step:100},{type:"range",slug:"button_speed",nameJa:"\u30dc\u30bf\u30f3\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u901f\u5ea6",nameEn:"buttonSpeed",default:.3,min:0,max:1,step:.1},{type:"range",slug:"registered_button_opacity",nameJa:"\u767b\u9332\u6e08\u307f\u6642\u306e\u900f\u660e\u5ea6",nameEn:"Registered opacity",default:.55,min:.3,max:1,step:.05},{type:"select",slug:"align",nameJa:"\u30dc\u30bf\u30f3\u306e\u914d\u7f6e",nameEn:"align",default:"center",defaultJa:"\u4e2d\u592e\u5bc4\u305b",defaultEn:"Center",selectOptionsJa:[{value:"left",label:"\u5de6\u5bc4\u305b"},{value:"center",label:"\u4e2d\u592e\u5bc4\u305b"},{value:"right",label:"\u53f3\u5bc4\u305b"}],selectOptionsEn:[{value:"left",label:"Align left"},{value:"center",label:"Align center"},{value:"right",label:"Align right"}]}]}},357(e,t){t.StatusWidget=void 0;t.StatusWidget=class{getMessages(){var e;const t=(null===(e=null===window||void 0===window?void 0:window.Shopify)||void 0===e?void 0:e.locale)||"";return"string"==typeof t&&t.toLowerCase().startsWith("ja")?{lineTitle:"LINE\u8a2d\u5b9a: ",lineOn:"\u8a2d\u5b9a\u6e08",lineOff:"\u672a\u767b\u9332",lineConnect:"\u767b\u9332\u3059\u308b",lineDisconnect:"\u89e3\u9664\u3059\u308b",mailTitle:"\u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3: ",mailOn:"\u8cfc\u8aad\u4e2d",mailOff:"\u672a\u8cfc\u8aad",mailSubscribe:"\u8cfc\u8aad\u3059\u308b",mailUnsubscribe:"\u8cfc\u8aad\u89e3\u9664\u3059\u308b"}:{lineTitle:"LINE settings: ",lineOn:"Connected",lineOff:"Not connected",lineConnect:"Connect",lineDisconnect:"Disconnect",mailTitle:"Newsletter: ",mailOn:"Subscribed",mailOff:"Not subscribed",mailSubscribe:"Subscribe",mailUnsubscribe:"Unsubscribe"}}constructor(e,t,o){this.position="beforeend",this.header=e,this.config=o,this.position=t}setParent(e){this.parent=e}render(){this.parent&&this.parent.getStatus(e=>{this.renderedWidget&&(this.renderedWidget.remove(),this.renderedWidget=void 0),this.renderedWidget=this.createWidget(e),this.header.insertAdjacentElement(this.position,this.renderedWidget)},e=>{console.error("StoreCRM: StatusWidget render failed",e)}),this.parent||console.error("StoreCRM render: no parent. Abort.")}isLineVisible(e){return e.line_show_account&&(!e.line_debug_account||document.querySelector("#OnlineStorePreviewBarNextData")||window.Shopify.designMode)}createWidget(e){var t,o,n,i;const r=document.createElement("div");function s(e){const t=document.createElement("span");return t.classList.add("storecrm-off"),t.appendChild(document.createTextNode(e)),t}function a(e){const t=document.createElement("span");return t.classList.add("storecrm-on"),t.appendChild(document.createTextNode(e)),t}function l(e){const t=document.createElement("button");return t.classList.add("storecrm-button","storecrm-button-off"),t.appendChild(document.createTextNode(e)),t}function c(e){const t=document.createElement("button");return t.classList.add("storecrm-button","storecrm-button-on"),t.appendChild(document.createTextNode(e)),t}r.classList.add("storecrm-status-widget");const d=this.getMessages();if(this.isLineVisible(e)){const n=document.createElement("div");n.appendChild(document.createTextNode(d.lineTitle)),n.appendChild(e.line?a(d.lineOn):s(d.lineOff)),this.lineButton=e.line?l(d.lineDisconnect):c(d.lineConnect),n.appendChild(this.lineButton),r.appendChild(n),e.line?null===(t=this.lineButton)||void 0===t||t.addEventListener("click",this.lineUnsubscribe.bind(this)):null===(o=this.lineButton)||void 0===o||o.addEventListener("click",this.lineSubscribe.bind(this))}if(e.mail_show_account){const t=document.createElement("div");t.appendChild(document.createTextNode(d.mailTitle)),t.appendChild(e.accepts_marketing?a(d.mailOn):s(d.mailOff)),this.mailButton=e.accepts_marketing?l(d.mailUnsubscribe):c(d.mailSubscribe),t.appendChild(this.mailButton),r.appendChild(t),e.accepts_marketing?null===(n=this.mailButton)||void 0===n||n.addEventListener("click",this.unsubscribe.bind(this)):null===(i=this.mailButton)||void 0===i||i.addEventListener("click",this.subscribe.bind(this))}return r}lineSubscribe(){this.parent&&this.parent.lineSubscribe(function(e){alert(e)})}lineUnsubscribe(){this.parent&&this.parent.lineUnsubscribe(function(e){alert(e)})}subscribe(){this.parent&&this.parent.mailSubscribe(function(e){alert(e)})}unsubscribe(){this.parent&&this.parent.mailUnsubscribe(function(e){alert(e)})}}},664(e,t,o){var n=this&&this.__awaiter||function(e,t,o,n){return new(o||(o=Promise))(function(i,r){function s(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=o(475),s=o(332),a=o(304),l=o(482),c=o(169),d=o(824),u=o(203),h=o(357),m=o(232),p=i(o(430)),g=o(811),f=o(250),_=o(308);o(389);class v{constructor(e){this.statusWidget=void 0,this.isTokenRefreshed=!1,this.isTokenFetching=!1,this.favoriteMode="product",this.favoriteKey="products",this.checkConnectExecuted=!1,this.widgetTemplates={},this.widgetTemplateLoaded=!1,this.pendingRestockIntentProcessing=!1,this.pendingRestockRetryAttempts=0,this.pendingLineRestockConnectRedirectStarted=!1,this.restockStatusCache=new Map,this.restockStatusRequests=new Map,this.optimisticRestockRegistered=new Map,this.restockStateWatcherStarted=!1,this.lastRestockStateHref="",this.restockButtonVariantByKey=new Map,window.storecrm_data=window.storecrm_data||{},console.log("StoreCRM initialized version 0.7.158",e),this.config=this.applyLocaleOverrides(e),this.currentLocale=this.detectLocale(),this.applyDefaults(),this.popupManager=c.RestockPopupManager.getInstance(this.config.restockPopup),this.popupManager.setParent(this),this.lineRestockPopupManager=u.LineRestockPopupManager.getInstance(this.config.lineRestockPopup),this.lineRestockPopupManager.setParent(this)}init(){this.checkPendingRestockIntentAfterPageReturn(),(()=>{n(this,void 0,void 0,function*(){try{if(document.querySelector("[data-storecrm-preview-context]"))return console.log("StoreCRM: Favorite preview context detected; skipping customer and token initialization"),void(yield this.renderFavoriteList());if(this.isConnectProxyPage())return yield this.checkCustomer({syncWishlist:!1}),void this.checkConnect();yield this.bootstrapTemplates(),yield this.checkCustomer(),yield this.syncWishlist()}catch(e){console.error("StoreCRM: init: error",e)}yield this.render(),yield this.handlePendingRestockIntent();const e=document.querySelector("[data-storecrm-preview-context]"),t=(0,f.isAppProxyPathname)(window.location.pathname,this.config.appProxyPath,this.config.appProxyName);console.log("StoreCRM: Favorite list page detection",{hasPreviewContext:Boolean(e),isFavoriteProxyPage:t,pathname:window.location.pathname,appProxyPath:this.config.appProxyPath,appProxyName:this.config.appProxyName}),(e||t)&&(yield this.renderFavoriteList())})})(),window.addEventListener("pageshow",e=>{e.persisted&&this.render(!0),this.checkPendingRestockIntentAfterPageReturn()}),window.addEventListener("focus",()=>{this.checkPendingRestockIntentAfterPageReturn()}),window.addEventListener("storecrm:locationchange",()=>{this.checkPendingRestockIntentAfterPageReturn()}),document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&(this.render(!0),this.handlePendingRestockIntent().catch(e=>{console.warn("StoreCRM: pending restock check after visibilitychange failed",e)}))}),this.initLineLogin(),this.initRestockStateWatcher(),this.initDynamicRenderObserver()}isConnectProxyPage(){return window.location.pathname.includes("/apps")&&window.location.pathname.endsWith("/connect")}initLineLogin(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{this.executeLineLoginInit()}):this.executeLineLoginInit()}executeLineLoginInit(){if(p.default.isLoginOrRegisterPage()){new p.default(this).init()}}getCurrentShopifyCustomerId(){try{return window.storecrm_data.customer_id||window.ShopifyAnalytics.meta.page.customerId}catch(e){return null}}checkCustomer(){return n(this,arguments,void 0,function*(e={}){if(window.storecrm_data.is_customer_checked)return;window.storecrm_data.is_customer_checked=!0;const t=(window.localStorage.getItem("storecrm_customer_id")||"").toString(),o=(this.getCurrentShopifyCustomerId()||"").toString();if(t!==o){if(o)return!t||t.startsWith("TEMP_")&&o?(yield this.refreshToken(!1,e),void(!1!==e.syncWishlist&&(yield this.syncWishlist(null,t,!0)))):void(t===o||(yield this.refreshToken(!0)));(null==t?void 0:t.startsWith("TEMP_"))||(yield this.refreshToken(!0))}})}refreshToken(){return n(this,arguments,void 0,function*(e=!1,t={}){return e&&(window.localStorage.removeItem("storecrm_customer_id"),window.localStorage.removeItem("storecrm_wishlist")),yield this.fetchToken(t)})}detectLocale(){var e,t;return([window.Shopify&&(window.Shopify.locale||(null===(t=null===(e=window.Shopify.localization)||void 0===e?void 0:e.language)||void 0===t?void 0:t.isoCode)),document.documentElement.getAttribute("lang"),navigator.language].find(e=>"string"==typeof e&&e.length>0)||"en").replace("_","-")}normalizeLocaleValue(e){if("string"==typeof e)return e.replace("_","-").toLowerCase()}findLocaleFromConfig(e){var t;const o=this.normalizeLocaleValue(null===(t=window.Shopify)||void 0===t?void 0:t.locale);if(!e||!o)return;const n=Object.entries(e).map(([e,t])=>({normalizedKey:this.normalizeLocaleValue(e),value:t})).filter(e=>e.normalizedKey),i=n.find(e=>e.normalizedKey===o);if(i)return i.value;const r=o.split("-")[0],s=n.find(e=>e.normalizedKey&&e.normalizedKey.split("-")[0]===r);if(s)return s.value;const a=n.find(e=>e.normalizedKey&&e.normalizedKey.startsWith(r));return a?a.value:void 0}isPlainObject(e){return"[object Object]"===Object.prototype.toString.call(e)}deepMergeConfig(e,t){if(!this.isPlainObject(t)&&!Array.isArray(t))return t;if(Array.isArray(t))return t.slice();const o=this.isPlainObject(e)?Object.assign({},e):{};return Object.keys(t||{}).forEach(e=>{const n=o[e],i=t[e];"favoriteMode"!==e&&(this.isPlainObject(n)&&this.isPlainObject(i)?o[e]=this.deepMergeConfig(n,i):this.isPlainObject(i)?o[e]=this.deepMergeConfig({},i):Array.isArray(i)?o[e]=i.slice():o[e]=i)}),o}applyLocaleOverrides(e){const t=e.locales,o=Object.assign({},e),n=this.findLocaleFromConfig(t);if(!n)return o;const i=this.deepMergeConfig(o,n);return t&&(i.locales=t),i}getSchemaDefault(e){const t=(this.currentLocale||"en").toLowerCase();if(null==e)return;const o=e=>null!=e;return void 0!==e.default&&null!==e.default&&"text"!==e.type?e.default:t.startsWith("ja")&&o(e.defaultJa)?e.defaultJa:t.startsWith("en")&&o(e.defaultEn)?e.defaultEn:o(e.default)?e.default:o(e.defaultEn)?e.defaultEn:o(e.defaultJa)?e.defaultJa:""}mergeWidgetConfig(e,t,o){const n=Object.assign({},t||{});return(e&&e.rows||[]).forEach(e=>{const t=e.slug;if(t){if(o&&Object.prototype.hasOwnProperty.call(o,t)){const i=o[t];if(!Object.prototype.hasOwnProperty.call(n,t))return void(n[t]=i);const r=n[t],s=this.getSchemaDefault(e);return void(null!=r&&""!==r&&r!==s||(n[t]=i))}Object.prototype.hasOwnProperty.call(n,t)||(n[t]=this.getSchemaDefault(e))}}),n}applyDefaults(e){const t=e||this.widgetTemplates||{};this.config.favorite=this.mergeWidgetConfig(r.schema,this.config.favorite,t.favorite),this.config.favoriteList=this.mergeWidgetConfig(s.schema,this.config.favoriteList,t["favorite-list"]),this.config.restock=this.mergeWidgetConfig(a.schema,this.config.restock,t.restock),this.config.lineRestock=this.mergeWidgetConfig((()=>{try{return o(482).schema||{rows:[]}}catch(e){return{rows:[]}}})(),this.config.lineRestock,t["line-restock"]),this.config.restockPopup=this.mergeWidgetConfig(c.schema,this.config.restockPopup,t["restock-popup"]),this.config.restockOption=this.mergeWidgetConfig(d.schema,this.config.restockOption,void 0),this.config.lineRestockPopup=this.mergeWidgetConfig(u.schema,this.config.lineRestockPopup,t["line-restock-popup"]),this.favoriteMode=this.config.favorite.favoriteMode||"product",this.favoriteKey="product"===this.favoriteMode?"products":"variants",console.log("StoreCRM: Current favorite mode: ",this.favoriteMode)}bootstrapTemplates(){return n(this,void 0,void 0,function*(){if(this.widgetTemplateLoaded)return;const e=encodeURIComponent(this.currentLocale||"en"),t=Object.entries({favorite:"favorite",restock:"restock","restock-popup":"restock-popup","line-restock":"line-restock","line-restock-popup":"line-restock-popup"}),o=yield Promise.all(t.map(t=>n(this,[t],void 0,function*([t,o]){try{const n=yield fetch(`${this.config.backendUrl}/widget/templates/${o}?locale=${e}`,{credentials:"same-origin"});if(!n.ok)return[t,void 0];return[t,(yield n.json()).template||{}]}catch(e){return console.warn("StoreCRM: Failed to load widget template",o,e),[t,void 0]}}))),i={};o.forEach(([e,t])=>{t&&(i[e]=t)}),this.widgetTemplates=i,this.applyDefaults(i),this.popupManager.config=this.config.restockPopup,this.lineRestockPopupManager.config=this.config.lineRestockPopup,this.widgetTemplateLoaded=!0})}render(e=!1){this.doRender(e),e||(window.setTimeout(this.doRender.bind(this),500),window.setTimeout(this.doRender.bind(this),2e3),window.setTimeout(this.doRender.bind(this),5e3))}initDynamicRenderObserver(){if(this.dynamicRenderObserver||"undefined"==typeof MutationObserver)return;const e=document.body||document.documentElement;e?(this.dynamicRenderObserver=new MutationObserver(e=>{e.some(e=>Array.from(e.addedNodes).some(e=>this.isStorecrmRenderableNode(e)))&&this.scheduleDynamicRender()}),this.dynamicRenderObserver.observe(e,{childList:!0,subtree:!0})):document.addEventListener("DOMContentLoaded",()=>this.initDynamicRenderObserver(),{once:!0})}isStorecrmRenderableNode(e){if(!(e instanceof Element))return!1;const t=".storecrm-button[data-type], .storecrm-favorite, .storecrm_favoritelist";return e.matches(t)||Boolean(e.querySelector(t))}scheduleDynamicRender(e=50){void 0===this.dynamicRenderTimer&&(this.dynamicRenderTimer=window.setTimeout(()=>{this.dynamicRenderTimer=void 0,this.render(!0),this.handlePendingRestockIntent().catch(e=>{console.warn("StoreCRM: pending restock check after dynamic render failed",e)})},e))}doRender(e=!1){window.location.pathname.includes("/apps")&&window.location.pathname.endsWith("/connect")&&this.checkConnect();const t=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}");t.products||(t.products=[]),t.variants||(t.variants=[]),document.querySelectorAll(".storecrm-button").forEach(e=>{if(e instanceof HTMLElement==!1)return;const o=e.id||"storecrm-button-"+Math.random().toString(36).slice(-8);e.id||(e.id=o);const n=new URL(location.href),i=n.searchParams.get("variant")&&n.searchParams.get("variant"),s=e.dataset.productId,c=i||e.dataset.variantId,d=void 0!==e.dataset.variantSelector,u=JSON.parse(e.dataset.variants||"[]"),h={tags:JSON.parse(e.dataset.productTags||"[]"),id:e.dataset.productId};if(!h||!s||!c)return;const m=t&&("product"===this.favoriteMode?(0,g.containsShopifyId)(t.products,s):(0,g.containsShopifyId)(t.variants,c)),p=!!e.dataset.currentVariantAvailable,f="wishlist-button"===e.dataset.type?(0,r.render)({productId:s,variantId:c,id:o,button:e,variants:u,product:h,buttonSettings:this.config.favorite,isFavorited:m,hasVariantSelector:d}):"line-restock-button"===e.dataset.type?(0,l.render)({productId:s,variantId:c,id:o,buttonSettings:this.config.lineRestock||(0,l.generateDefaultSettings)(),isOutOfStock:p,product:h,variants:u}):(0,a.render)({productId:s,variantId:c,id:o,buttonSettings:this.config.restock,isOutOfStock:p,product:h,variants:u});f&&(e.innerHTML=f)}),this.refreshAllRestockButtonStates(),document.querySelectorAll(".storecrm-favorite").forEach(o=>{if(o instanceof HTMLElement==!1)return;if(!e&&"true"===o.dataset.isRendered)return;o.dataset.isRendered="true";const n=o.dataset.productId||"",i=o.dataset.variantId||"";if(!n)return;const s=void 0!==o.dataset.variantSelector,a=o.id||"storecrm-favorite-"+Math.random().toString(36).slice(-8);o.id||(o.id=a);const l=JSON.parse(o.dataset.variants||"[]"),c={tags:JSON.parse(o.dataset.productTags||"[]"),id:o.dataset.productId},d=t&&(0,g.containsShopifyId)(t.products,n);o.innerHTML=(0,r.render)({productId:n,variantId:i,button:o,id:a,buttonSettings:this.config.favorite,isFavorited:d,hasVariantSelector:s,variants:l,product:c})||""}),this.shouldRenderStatusWidget(window.location.pathname)&&this.renderStatusWidget(),this.checkToken()}checkToken(){this.isTokenRefreshed||this.isTokenRefreshNeeded()&&this.fetchToken()}isTokenRefreshNeeded(){const e=window.localStorage.getItem("storecrm_customer_id"),t=parseInt(window.localStorage.getItem("storecrm_customer_id")||"0",10),o=window.localStorage.getItem("storecrm_token");let n=null;try{n=o?o.split("|")[1]:null}catch(e){}return this.isTokenRefreshed?(console.log("StoreCRM: Token refresh needed: false (already refreshed)"),!1):e&&o&&n?window.ShopifyAnalytics&&window.ShopifyAnalytics.meta&&window.ShopifyAnalytics.meta.page&&window.ShopifyAnalytics.meta.page.customerId&&window.ShopifyAnalytics.meta.page.customerId!==t?(console.log("StoreCRM: Token refresh needed: true (customerId mismatch)"),!0):window.ShopifyAnalytics&&window.ShopifyAnalytics.meta&&window.ShopifyAnalytics.meta.page&&window.ShopifyAnalytics.meta.page.customerId?1e3*parseFloat(n)<(new Date).getTime()&&(console.log("StoreCRM: Token refresh needed: true (expired)"),!0):(console.log("StoreCRM: Token refresh needed: true (no customerId)"),!0):(console.log("StoreCRM: Token refresh needed: true (no token)"),!0)}shouldRenderStatusWidget(e){try{const t=this.normalizePathname(e);if(!t)return!1;const o=this.getAccountPathIndex(t);if(-1===o)return!1;const n=(t.split("/")[o+1]||"").toLowerCase();return!this.getExcludedAccountPages().has(n)}catch(t){return console.warn("StoreCRM: Invalid pathname for widget rendering:",e,t),!1}}getExcludedAccountPages(){return new Set(this.config.excludedAccountPages||v.DEFAULT_EXCLUDED_ACCOUNT_PAGES)}getAccountPathIndex(e){const t=this.normalizePathname(e);if(!t)return-1;const o=t.split("/"),n=(o[0]||"").toLowerCase();if("account"===n)return 0;const i=(o[1]||"").toLowerCase();return o.length>=2&&v.LOCALE_PATTERN.test(n)&&"account"===i?1:-1}normalizePathname(e){if("string"!=typeof e)throw new TypeError("Expected pathname to be a string, but received "+typeof e);return e.replace(/\/{2,}/g,"/").replace(/^\/|\/$/g,"")||null}fetchToken(){return n(this,arguments,void 0,function*(e={}){if(this.isTokenFetching)return yield new Promise(e=>{const t=Date.now(),o=setInterval(()=>{(!this.isTokenFetching||Date.now()-t>=1e4)&&(clearInterval(o),e(null))},100)}),window.localStorage.getItem("storecrm_token");this.isTokenFetching=!0;try{const t=window.localStorage.getItem("storecrm_customer_id"),o=(0,f.buildAppProxyUrl)("/token",{path:this.config.appProxyPath,name:this.config.appProxyName}),n=yield fetch(`${o}?current_customer_id=${t}`),i=(yield n.text()).match(/\[data\]([\s\S]*?)\[\/data\]/);if(!i)throw this.isTokenRefreshed=!0,new Error("No data from API");const r=JSON.parse(i[1]);if(!r||!r.customer)throw this.isTokenRefreshed=!0,new Error("No data from API2");return window.localStorage.setItem("storecrm_token",r.customer.token),window.localStorage.setItem("storecrm_customer_id",r.customer.id),this.isTokenRefreshed=!0,!1!==e.syncWishlist&&(null==t?void 0:t.startsWith("TEMP_"))&&r.customer.id!==t&&(yield this.syncWishlist(null,t)),r.customer.token}finally{this.isTokenFetching=!1}})}getToken(){return n(this,void 0,void 0,function*(){this.isTokenFetching&&(yield this.fetchToken());let e=window.localStorage.getItem("storecrm_token");return this.isValidStoreCRMToken(e)||(e=yield this.fetchToken()),e})}getCustomerId(){return n(this,void 0,void 0,function*(){return this.isTokenFetching&&(yield this.fetchToken()),window.localStorage.getItem("storecrm_customer_id")})}isValidStoreCRMToken(e){return Boolean(e&&3===e.split("|").length&&e.split("|")[2])}getShopDomainFromStoreCRMToken(e){return this.isValidStoreCRMToken(e)&&e.split("|")[2]||window.location.host}request(){return n(this,arguments,void 0,function*(e="GET",t,o=null,i=!1){const r=window.location.href,s=e=>n(this,void 0,void 0,function*(){const o=yield this.getCustomerId(),n=this.getShopDomainFromStoreCRMToken(e),i=t.includes("?")?"&":"?";return`${t}${i}customer_id=${o}&host=${n}&referrer=${encodeURIComponent(r)}`});let a=null;for(let n=0;n<=2;n++){const r=yield this.getToken();if(a=yield fetch(yield s(r),{method:e,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:o?JSON.stringify(o):null,credentials:i?"include":"same-origin"}),401!==a.status||2===n)break;console.warn("StoreCRM: API request unauthorized. Refreshing token and retrying.",{url:t,retryCount:n}),yield this.fetchToken()}if(!a||!a.ok)throw new Error("API request failed"+(a?`: ${a.status}`:""));return a.json()})}toggleWishlist(e,t=!1,o=!1,n=""){o?this.fetchToken().then(()=>{var o=window.localStorage.getItem("storecrm_customer_id");o&&!/^TEMP_/.test(o)?this.doToggleWishlist(e,!t).then(()=>{}).catch(e=>{console.error(e),alert("\u30b5\u30fc\u30d0\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\uff01 error: "+e.message+" \u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002")}):window.location.href=n&&""!==n&&"undefined"!==n&&void 0!==n?n:"/account/login"}):this.doToggleWishlist(e,!t).then(()=>{}).catch(e=>{console.error(e),alert("\u30b5\u30fc\u30d0\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\uff01 error: "+e.message+" \u3057\u3070\u3089\u304f\u305f\u3063\u3066\u304b\u3089\u518d\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002")})}syncWishlist(){return n(this,arguments,void 0,function*(e=null,t=void 0,o=!1){if(!o){const e=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}"),t=6e4;if(e.lastUpdated&&Date.now()-e.lastUpdated{console.error("StoreCRM Restock: click flow failed",e),this.popupManager.show(this.config.restockPopup,o.variants,o.productId)}):console.error("StoreCRM Restock: restockButton not found")}isRestockLoginRequired(){var e;return this.toBoolean(null===(e=this.config.restockOption)||void 0===e?void 0:e.require_login_for_restock)}shouldAutoRegisterRestockAfterLogin(){var e;return this.toBoolean(null===(e=this.config.restockOption)||void 0===e?void 0:e.auto_register_after_login)}shouldOneClickRestockWhenLoggedIn(){var e;return this.toBoolean(null===(e=this.config.restockOption)||void 0===e?void 0:e.one_click_when_logged_in)}shouldShowRestockRegisteredState(){var e;return this.toBoolean(null===(e=this.config.restockOption)||void 0===e?void 0:e.show_registered_status_when_logged_in)}getRestockRegistrationMode(e=[],t=""){return t||Array.isArray(e)&&e.length>1?"variant":this.favoriteMode}toBoolean(e){return!0===e||"true"===e||1===e||"1"===e}handleRestockButtonClick(e,t){return n(this,void 0,void 0,function*(){var o;const n=yield this.isLoggedInCustomer(),i=this.getCurrentRestockVariantId(t.variants),r=this.getRestockRegistrationMode(t.variants,i);if(n){if(this.shouldShowRestockRegisteredState()){const n=yield this.getRestockStatus(t.productId,i,r,!0);if(null===(o=null==n?void 0:n.email)||void 0===o?void 0:o.registered)return void this.applyRestockButtonRegisteredState("email",e,!0)}if(this.shouldOneClickRestockWhenLoggedIn())return void(yield this.registerEmailRestockOneClick(e,t,i))}if(this.isRestockLoginRequired()&&!n){const o=this.buildPendingRestockIntent(e,t);return void this.showRestockLoginRequiredModal(o)}this.popupManager.show(this.config.restockPopup,t.variants,t.productId)})}registerEmailRestockOneClick(e,t,o){return n(this,void 0,void 0,function*(){var n;const i=null===(n=window.storecrm_data)||void 0===n?void 0:n.customer_email;if(!i||!this.checkEmailFormat(i))return this.popupManager.show(this.config.restockPopup,t.variants,t.productId),void this.popupManager.failure("\u30ed\u30b0\u30a4\u30f3\u4e2d\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u5165\u529b\u3057\u3066\u767b\u9332\u3057\u3066\u304f\u3060\u3055\u3044\u3002");try{const n=this.getRestockRegistrationMode(t.variants,o);yield this.doStoreRestock(o,t.productId,i,!1,!1,!1,n),this.shouldShowRestockRegisteredState()?(this.markRestockStatusCacheRegistered("email",t.productId,o,n),this.applyRestockButtonRegisteredState("email",e,!0),this.refreshAllRestockButtonStates(!1)):this.invalidateRestockStatusCache(t.productId,o,n),this.popupManager.show(this.config.restockPopup,t.variants,t.productId,{readOnly:!0,hideSubmitButton:!0,variantId:o,email:i}),this.popupManager.success(this.config.restockPopup.success_text)}catch(e){console.error("StoreCRM Restock: one-click registration failed",e),this.popupManager.show(this.config.restockPopup,t.variants,t.productId),this.popupManager.failure(this.config.restockPopup.error_text)}})}handleLoginRequiredRestockClick(e,t){return n(this,void 0,void 0,function*(){if(yield this.isLoggedInCustomer())return void this.popupManager.show(this.config.restockPopup,t.variants,t.productId);const o=this.buildPendingRestockIntent(e,t);this.showRestockLoginRequiredModal(o)})}buildPendingRestockIntent(e,t,o="email"){return{version:1,channel:o,product_id:String(t.productId),variant_id:this.getCurrentRestockVariantId(t.variants),pdp_url:window.location.href,button_id:e,clicked_at:(new Date).toISOString(),created_at:Date.now(),auto_register_after_login:this.shouldAutoRegisterRestockAfterLogin(),mode:this.getRestockRegistrationMode(t.variants,this.getCurrentRestockVariantId(t.variants))}}getCurrentRestockVariantId(e){const t=new URL(window.location.href).searchParams.get("variant");if(t)return String(t);const o=this.getSelectedProductFormVariantId(e);if(o)return o;const n=(e||[]).find(e=>!e.available)||(e||[])[0];return n&&n.id?String(n.id):""}getSelectedProductFormVariantId(e){if(!document||!Array.isArray(e)||0===e.length)return"";const t=new Set(e.map(e=>String(e.id))),o=['form[action*="/cart/add"] input[name="id"]','form[action*="/cart/add"] select[name="id"]','product-form input[name="id"]','product-form select[name="id"]','input[name="id"]','select[name="id"]'];for(const e of o){const o=Array.from(document.querySelectorAll(e)).find(e=>{const o=String(e.value||"");return o&&t.has(o)});if(o)return String(o.value)}return""}initRestockStateWatcher(){if(this.restockStateWatcherStarted)return;this.restockStateWatcherStarted=!0,this.lastRestockStateHref=window.location.href;const e=()=>{this.refreshAllRestockButtonStates(!1)},t=()=>{this.refreshAllRestockButtonStates(!0)},o=()=>{e(),window.setTimeout(e,60),window.setTimeout(t,250),this.checkPendingRestockIntentAfterPageReturn()};window.navigation&&window.navigation.addEventListener("navigate",()=>{o()}),this.patchHistoryForRestockStateWatcher(),window.addEventListener("storecrm:locationchange",o),window.addEventListener("popstate",o),document.addEventListener("change",e=>{this.isVariantChangeTarget(e.target)&&o()},!0),["variant:change","variant:changed","product:variant-change","shopify:section:load"].forEach(e=>{document.addEventListener(e,o)}),window.setInterval(()=>{this.lastRestockStateHref!==window.location.href&&(this.lastRestockStateHref=window.location.href,o())},1e3)}patchHistoryForRestockStateWatcher(){const e="__storecrmRestockHistoryPatched";window[e]||(window[e]=!0,["pushState","replaceState"].forEach(e=>{const t=window.history[e];window.history[e]=(...e)=>{const o=t.apply(window.history,e);return window.dispatchEvent(new Event("storecrm:locationchange")),o}}))}isVariantChangeTarget(e){if(!(e instanceof HTMLElement))return!1;if(e.matches('input[name="id"], select[name="id"]'))return!0;const t=e.name||e.getAttribute("name")||"";return!!/options?\[|option-|variant/i.test(t)||Boolean(e.closest('variant-selects, variant-radios, product-form, .product-form, [data-product-form], [data-section*="product"]')&&e.matches("input, select"))}refreshAllRestockButtonStates(e=!1){"undefined"!=typeof document&&document.querySelectorAll(".storecrm-button").forEach(t=>{if(!(t instanceof HTMLElement))return;const o=t.id;if(o)try{if("restock-button"===t.dataset.type){const t=a.RestockButton.getInstance(o);this.refreshRestockButtonState("email",o,t.productId,t.variants,this.getRestockRegistrationMode(t.variants,this.getCurrentRestockVariantId(t.variants)),e)}else if("line-restock-button"===t.dataset.type){const t=l.LineRestockButton.getInstance(o);this.refreshRestockButtonState("line",o,t.productId,t.variants,this.getRestockRegistrationMode(t.variants,this.getCurrentRestockVariantId(t.variants)),e)}}catch(e){}})}refreshRestockButtonState(e,t,o,i,r){return n(this,arguments,void 0,function*(e,t,o,n,i,r=!1){let s="";try{if(s=this.prepareRestockButtonStateRefresh(e,t,o,n,i),!this.shouldApplyRestockRegisteredState())return this.applyRestockButtonLoadingState(e,t,!1),void this.applyRestockButtonRegisteredState(e,t,!1);const a=this.getFreshCachedRestockStatus(o,s,i);if(a&&(this.applyRestockButtonLoadingState(e,t,!1),this.applyRestockButtonRegisteredState(e,t,this.isRestockStatusRegistered(e,o,s,i,a)),!r))return;const l=yield this.isLoggedInCustomer(),c=this.getCurrentRestockVariantId(n);if(c!==s)return void this.refreshRestockButtonState(e,t,o,n,this.getRestockRegistrationMode(n,c),!0);if(!l)return this.applyRestockButtonLoadingState(e,t,!1),void this.applyRestockButtonRegisteredState(e,t,!1);const d=yield this.getRestockStatus(o,s,i,r),u=this.getCurrentRestockVariantId(n);if(u!==s)return void this.refreshRestockButtonState(e,t,o,n,this.getRestockRegistrationMode(n,u),!0);this.applyRestockButtonLoadingState(e,t,!1),this.applyRestockButtonRegisteredState(e,t,this.isRestockStatusRegistered(e,o,s,i,d))}catch(o){s&&this.getCurrentRestockVariantId(n)===s&&this.applyRestockButtonLoadingState(e,t,!1),console.warn("StoreCRM Restock: failed to refresh registration status",o)}})}prepareRestockButtonStateRefresh(e,t,o,n,i){const r=this.getCurrentRestockVariantId(n),s=`${e}:${t}`,a=this.restockButtonVariantByKey.get(s),l=Boolean(a&&a!==r);l&&this.applyRestockButtonRegisteredState(e,t,!1),this.restockButtonVariantByKey.set(s,r);return this.getFreshCachedRestockStatus(o,r,i)?this.applyRestockButtonLoadingState(e,t,!1):l&&(this.applyRestockButtonRegisteredState(e,t,!1),this.applyRestockButtonLoadingState(e,t,!0)),r}getRestockStatusCacheKey(e,t,o){return`${o}:${e}:${t||""}`}getOptimisticRestockRegisteredKey(e,t,o,n){return`${e}:${this.getRestockStatusCacheKey(t,o,n)}`}isOptimisticRestockRegistered(e,t,o,n){const i=this.getOptimisticRestockRegisteredKey(e,t,o,n),r=this.optimisticRestockRegistered.get(i);return!!r&&(!(Date.now()-r>=3e4)||(this.optimisticRestockRegistered.delete(i),!1))}isRestockStatusRegistered(e,t,o,n,i){var r;return Boolean(null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.registered)||this.isOptimisticRestockRegistered(e,t,o,n)}shouldApplyRestockRegisteredState(){return this.shouldShowRestockRegisteredState()}getFreshCachedRestockStatus(e,t,o){const n=this.restockStatusCache.get(this.getRestockStatusCacheKey(e,t,o));return!n||Date.now()-n.fetchedAt>=3e4?null:n.value}invalidateRestockStatusCache(e,t,o){this.restockStatusCache.delete(this.getRestockStatusCacheKey(e,t,o))}markRestockStatusCacheRegistered(e,t,o,n){this.optimisticRestockRegistered.set(this.getOptimisticRestockRegisteredKey(e,t,o,n),Date.now());const i=this.getFreshCachedRestockStatus(t,o,n)||{mode:n,product_id:t,variant_id:o||null,email:{registered:!1,customer_restock_id:null},line:{registered:!1,customer_restock_id:null,line_connected:!1}};i[e]=Object.assign(Object.assign({},i[e]),{registered:!0}),this.restockStatusCache.set(this.getRestockStatusCacheKey(t,o,n),{value:i,fetchedAt:Date.now()})}getRestockStatus(e,t,o){return n(this,arguments,void 0,function*(e,t,o,n=!1){var i;if(!e||"variant"===o&&!t)return null;const r=this.getRestockStatusCacheKey(e,t,o),s=this.getFreshCachedRestockStatus(e,t,o);if(!n&&s)return s;const a=this.restockStatusRequests.get(r);if(a)return a;const l=new URLSearchParams({product_id:e,mode:o});t&&l.set("variant_id",t);const c=null===(i=window.storecrm_data)||void 0===i?void 0:i.customer_email;c&&this.checkEmailFormat(c)&&l.set("email",c);const d=this.request("GET",`${this.config.backendUrl}/frontend/restock/status?${l.toString()}`).then(e=>(this.restockStatusCache.set(r,{value:e,fetchedAt:Date.now()}),e)).catch(e=>(console.warn("StoreCRM Restock: status request failed",e),null)).finally(()=>{this.restockStatusRequests.delete(r)});return this.restockStatusRequests.set(r,d),d})}getRestockButtonSettings(e){return"line"===e?this.config.lineRestock||{}:this.config.restock||{}}getNonEmptyRestockButtonSetting(e,t){var o;const n=null===(o=this.getRestockButtonSettings(e))||void 0===o?void 0:o[t];return"string"==typeof n&&""!==n.trim()?n:void 0}getRegisteredRestockButtonText(e){const t=this.getNonEmptyRestockButtonSetting(e,"registered_button_text");return t||(/^ja\b/i.test(this.currentLocale||"")?"\u767b\u9332\u6e08\u307f":"Registered")}getRegisteredRestockButtonOpacity(e){var t;const o=null===(t=this.getRestockButtonSettings(e))||void 0===t?void 0:t.registered_button_opacity,n="number"==typeof o?o:parseFloat(String(null!=o?o:""));return Number.isFinite(n)?String(Math.min(1,Math.max(.3,n))):"0.55"}getRestockButtonLoadingLabel(){return/^ja\b/i.test(this.currentLocale||"")?"\u78ba\u8a8d\u4e2d":"Checking"}ensureRestockLoadingStyle(){if(document.getElementById(v.RESTOCK_LOADING_STYLE_ID))return;const e=document.createElement("style");e.id=v.RESTOCK_LOADING_STYLE_ID,e.textContent="\n @keyframes storecrm-restock-spin {\n to { transform: rotate(360deg); }\n }\n .storecrm-restock-loading {\n position: relative;\n }\n .storecrm-restock-loading-spinner {\n width: 1.15em;\n height: 1.15em;\n border: 2px solid currentColor;\n border-top-color: transparent;\n border-radius: 999px;\n display: inline-block;\n animation: storecrm-restock-spin 0.75s linear infinite;\n }\n .storecrm-restock-loading-label {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n ",(document.head||document.body||document.documentElement).appendChild(e)}getRestockButtonLoadingHtml(){return`${this.getRestockButtonLoadingLabel()}`}rememberRestockButtonInlineStyles(e){"true"!==e.dataset.storecrmOriginalStyleSaved&&(e.dataset.storecrmOriginalStyleSaved="true",e.dataset.storecrmOriginalColor=e.style.color||"",e.dataset.storecrmOriginalBackgroundColor=e.style.backgroundColor||"",e.dataset.storecrmOriginalBorderColor=e.style.borderColor||"",e.dataset.storecrmOriginalOpacity=e.style.opacity||"",e.dataset.storecrmOriginalCursor=e.style.cursor||"",e.dataset.storecrmOriginalMinWidth=e.style.minWidth||"")}restoreRestockButtonInlineStyles(e){e.style.color=e.dataset.storecrmOriginalColor||"",e.style.backgroundColor=e.dataset.storecrmOriginalBackgroundColor||"",e.style.borderColor=e.dataset.storecrmOriginalBorderColor||"",e.style.opacity=e.dataset.storecrmOriginalOpacity||"",e.style.cursor=e.dataset.storecrmOriginalCursor||"",e.style.minWidth=e.dataset.storecrmOriginalMinWidth||"",delete e.dataset.storecrmOriginalStyleSaved,delete e.dataset.storecrmOriginalColor,delete e.dataset.storecrmOriginalBackgroundColor,delete e.dataset.storecrmOriginalBorderColor,delete e.dataset.storecrmOriginalOpacity,delete e.dataset.storecrmOriginalCursor,delete e.dataset.storecrmOriginalMinWidth}escapeCssIdentifier(e){return String(e).replace(/([^\w-])/g,"\\$1")}getRestockButtonSelector(e,t){return`.${"line"===e?"storecrm-line-restock":"storecrm-restock"}-${this.escapeCssIdentifier(t)}`}applyRestockButtonLoadingState(e,t,o){const n=this.getRestockButtonSelector(e,t);document.querySelectorAll(n).forEach(e=>{if(e instanceof HTMLButtonElement){if(e.dataset.storecrmOriginalText||(e.dataset.storecrmOriginalText=e.textContent||""),o)return this.ensureRestockLoadingStyle(),this.rememberRestockButtonInlineStyles(e),e.dataset.storecrmRestockLoading="true",e.dataset.storecrmRestockOriginalHtml||(e.dataset.storecrmRestockOriginalHtml=e.innerHTML),e.offsetWidth>0&&(e.style.minWidth=`${e.offsetWidth}px`),e.innerHTML=this.getRestockButtonLoadingHtml(),e.setAttribute("disabled","disabled"),e.setAttribute("aria-disabled","true"),e.setAttribute("aria-busy","true"),e.classList.add("storecrm-restock-loading"),void(e.style.cursor="progress");"true"===e.dataset.storecrmRestockLoading&&(e.removeAttribute("aria-busy"),e.classList.remove("storecrm-restock-loading"),delete e.dataset.storecrmRestockLoading,"true"!==e.dataset.storecrmRegistered&&(e.removeAttribute("disabled"),e.removeAttribute("aria-disabled"),e.innerHTML=e.dataset.storecrmRestockOriginalHtml||e.dataset.storecrmOriginalText||e.innerHTML||"",this.restoreRestockButtonInlineStyles(e)),delete e.dataset.storecrmRestockOriginalHtml)}})}applyRestockButtonRegisteredState(e,t,o){const n=this.getRestockButtonSelector(e,t);document.querySelectorAll(n).forEach(t=>{if(t instanceof HTMLButtonElement){if(t.dataset.storecrmOriginalText||(t.dataset.storecrmOriginalText=t.textContent||""),o)return this.rememberRestockButtonInlineStyles(t),t.dataset.storecrmStateDisabled="true",t.dataset.storecrmRegistered="true",t.textContent=this.getRegisteredRestockButtonText(e),t.setAttribute("disabled","disabled"),t.setAttribute("aria-disabled","true"),t.classList.add("storecrm-restock-registered"),t.style.color=this.getNonEmptyRestockButtonSetting(e,"registered_button_color")||t.style.color,t.style.backgroundColor=this.getNonEmptyRestockButtonSetting(e,"registered_button_background_color")||t.style.backgroundColor,t.style.borderColor=this.getNonEmptyRestockButtonSetting(e,"registered_button_border_color")||t.style.borderColor,t.style.opacity=this.getRegisteredRestockButtonOpacity(e),void(t.style.cursor="not-allowed");"true"===t.dataset.storecrmStateDisabled&&(t.removeAttribute("disabled"),t.removeAttribute("aria-disabled"),t.classList.remove("storecrm-restock-registered"),t.textContent=t.dataset.storecrmOriginalText||t.textContent||"",delete t.dataset.storecrmStateDisabled,delete t.dataset.storecrmRegistered,this.restoreRestockButtonInlineStyles(t))}})}buildGuestRestockRedirectUrl(e){var t;const o=null===(t=this.config.restockOption)||void 0===t?void 0:t.guest_redirect_url;if(this.isNonEmptyOption(o))return this.buildConfiguredGuestRestockRedirectUrl(o,e);const n=this.toGuestRestockReturnPath(e);try{const e=new URL(this.getStoreAccountLoginUrl(),window.location.origin);return e.searchParams.set(this.getGuestRestockReturnParamName(e),n),e.origin===window.location.origin?`${e.pathname}${e.search}${e.hash}`:e.toString()}catch(e){return`/account/login?return_url=${encodeURIComponent(n)}`}}buildConfiguredGuestRestockRedirectUrl(e,t){const o=this.toGuestRestockReturnPath(t);try{const t=new URL(e,window.location.origin);return t.searchParams.set(this.getConfiguredGuestRestockReturnParamName(t),o),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:t.toString()}catch(t){return e.trim()}}getConfiguredGuestRestockReturnParamName(e){return e.searchParams.has("return_to")||e.pathname.includes("/customer_authentication/login")?"return_to":"return_url"}getStoreAccountLoginUrl(){var e,t;const o=null===(e=window.storecrm_data)||void 0===e?void 0:e.account_login_url,n=null===(t=window.storecrm_data)||void 0===t?void 0:t.storefront_login_url;return this.isNewCustomerAccountsStore()?this.isNonEmptyOption(n)?n:this.isNonEmptyOption(o)?o:"/account/login":this.isNonEmptyOption(o)?o:this.isNonEmptyOption(n)?n:"/account/login"}isNewCustomerAccountsStore(){const e=this.config.shopifyCustomerAccountsIsClassic;if(!1===e||"false"===e||"0"===e)return!0;const t=String(this.config.shopifyCustomerAccountsVersion||"").toUpperCase();return"NEW"===t||"NEW_CUSTOMER_ACCOUNTS"===t}getGuestRestockReturnParamName(e){return e.searchParams.has("return_to")||e.pathname.includes("/customer_authentication/login")?"return_to":"return_url"}isNonEmptyOption(e){return"string"==typeof e&&""!==e.trim()&&"undefined"!==e}toGuestRestockReturnPath(e){try{const t=new URL(e,window.location.origin);return t.origin===window.location.origin||/(^|\/)products\//.test(t.pathname)?`${t.pathname}${t.search}${t.hash}`:t.toString()}catch(e){return window.location.pathname+window.location.search+window.location.hash}}setPendingRestockIntent(e){window.localStorage.setItem(v.PENDING_RESTOCK_INTENT_KEY,JSON.stringify(e))}getPendingRestockIntent(){const e=window.localStorage.getItem(v.PENDING_RESTOCK_INTENT_KEY);if(!e)return null;try{const t=JSON.parse(e);return t&&t.product_id&&t.pdp_url&&t.created_at?Object.assign(Object.assign({},t),{channel:"line"===t.channel?"line":"email"}):(this.clearPendingRestockIntent(),null)}catch(e){return this.clearPendingRestockIntent(),null}}clearPendingRestockIntent(){this.clearPendingRestockRetryTimer(),this.pendingLineRestockConnectRedirectStarted=!1,window.localStorage.removeItem(v.PENDING_RESTOCK_INTENT_KEY)}getPendingRestockVariants(e){return e.variant_id?[{id:e.variant_id,title:"",available:!1}]:[]}getUrlWithoutLineConnectResultParams(e,t=!1){const o=new URL(e);return o.searchParams.delete("line_connect"),o.searchParams.delete("line_login_error"),t&&o.searchParams.delete("line_profile_data"),o.toString()}removeLineConnectResultParamsFromUrl(e=!1){try{const t=window.location.href,o=this.getUrlWithoutLineConnectResultParams(t,e);o!==t&&window.history.replaceState({},"",o)}catch(e){console.warn("StoreCRM LineRestock: failed to clean LINE connect params",e)}}hasLineConnectResultParams(){try{const e=new URL(window.location.href);return e.searchParams.has("line_connect")||e.searchParams.has("line_profile_data")||e.searchParams.has("line_login_error")}catch(e){return!1}}clearPendingRestockRetryTimer(){void 0!==this.pendingRestockRetryTimer&&(window.clearTimeout(this.pendingRestockRetryTimer),this.pendingRestockRetryTimer=void 0),this.pendingRestockRetryAttempts=0}schedulePendingRestockIntentRetry(e=600){void 0===this.pendingRestockRetryTimer&&(this.pendingRestockRetryAttempts>=v.PENDING_RESTOCK_RETRY_LIMIT||(this.pendingRestockRetryAttempts+=1,this.pendingRestockRetryTimer=window.setTimeout(()=>{this.pendingRestockRetryTimer=void 0,this.handlePendingRestockIntent().catch(e=>{console.warn("StoreCRM: pending restock retry failed",e)})},e)))}checkPendingRestockIntentAfterPageReturn(){this.getPendingRestockIntent()&&this.handlePendingRestockIntent().catch(e=>{console.warn("StoreCRM: pending restock check after page return failed",e)})}showRestockLoginRequiredModal(e){this.pendingRestockLoginIntent=e,this.clearPendingRestockIntent();const t=this.ensureRestockLoginRequiredModal();if(!t)return this.setPendingRestockIntent(e),void(window.location.href=this.buildGuestRestockRedirectUrl(e.pdp_url));t.classList.add("is-open"),t.setAttribute("aria-hidden","false"),void 0===this.restockLoginRequiredPreviousOverflow&&(this.restockLoginRequiredPreviousOverflow=document.documentElement.style.overflow),document.documentElement.style.overflow="hidden";const o=t.querySelector('[data-storecrm-restock-login-action="login"]');null==o||o.focus()}hideRestockLoginRequiredModal(){const e=document.getElementById(v.RESTOCK_LOGIN_REQUIRED_MODAL_ID);e&&(e.classList.remove("is-open"),e.setAttribute("aria-hidden","true"),document.documentElement.style.overflow=this.restockLoginRequiredPreviousOverflow||"",this.restockLoginRequiredPreviousOverflow=void 0)}ensureRestockLoginRequiredModal(){if(!document||!document.body)return null;let e=document.getElementById(v.RESTOCK_LOGIN_REQUIRED_MODAL_ID);return e||(document.body.insertAdjacentHTML("beforeend",``),e=document.getElementById(v.RESTOCK_LOGIN_REQUIRED_MODAL_ID),this.bindRestockLoginRequiredModal(e)),e&&this.applyRestockLoginRequiredModalSettings(e),e}bindRestockLoginRequiredModal(e){e&&"true"!==e.dataset.storecrmBound&&(e.dataset.storecrmBound="true",e.addEventListener("click",e=>{var t;const o=e.target,n=null===(t=null==o?void 0:o.closest("[data-storecrm-restock-login-action]"))||void 0===t?void 0:t.getAttribute("data-storecrm-restock-login-action");if(n){if("login"===n){e.preventDefault();const t=this.pendingRestockLoginIntent;return t?(this.setPendingRestockIntent(t),this.hideRestockLoginRequiredModal(),void(window.location.href=this.buildGuestRestockRedirectUrl(t.pdp_url))):void this.hideRestockLoginRequiredModal()}e.preventDefault(),this.pendingRestockLoginIntent=void 0,this.clearPendingRestockIntent(),this.hideRestockLoginRequiredModal()}}))}getRestockLoginRequiredCopy(){const e=/^ja\b/i.test(this.currentLocale||"")?{title:"\u30ed\u30b0\u30a4\u30f3\u304c\u5fc5\u8981\u3067\u3059",description:"\u518d\u5165\u8377\u901a\u77e5\u3092\u53d7\u3051\u53d6\u308b\u306b\u306f\u30ed\u30b0\u30a4\u30f3\u304c\u5fc5\u8981\u3067\u3059\u3002",login:"\u30ed\u30b0\u30a4\u30f3",cancel:"\u30ad\u30e3\u30f3\u30bb\u30eb"}:{title:"Login required",description:"Please log in to receive restock notifications.",login:"Login",cancel:"Cancel"};return{title:this.getRestockLoginRequiredTextOption("login_required_modal_title",e.title),description:this.getRestockLoginRequiredTextOption("login_required_modal_description",e.description),login:this.getRestockLoginRequiredTextOption("login_required_modal_login_button_text",e.login),cancel:this.getRestockLoginRequiredTextOption("login_required_modal_cancel_button_text",e.cancel)}}getRestockLoginRequiredTextOption(e,t){var o;const n=null===(o=this.config.restockOption)||void 0===o?void 0:o[e];return this.isNonEmptyOption(n)?n:t}getRestockLoginRequiredColorOption(e,t){var o;const n=null===(o=this.config.restockOption)||void 0===o?void 0:o[e];return this.isNonEmptyOption(n)?n:t}getRestockLoginRequiredNumberOption(e,t,o,n){var i;const r=null===(i=this.config.restockOption)||void 0===i?void 0:i[e],s="number"==typeof r?r:Number.parseFloat(r);return Number.isFinite(s)?Math.min(n,Math.max(o,s)):t}applyRestockLoginRequiredModalSettings(e){const t=this.getRestockLoginRequiredCopy(),o=e.querySelector(".storecrm_modal__overlay"),n=e.querySelector(".storecrm_modal__container"),i=e.querySelector("#storecrm-restock-login-required-title"),r=e.querySelector("#storecrm-restock-login-required-content"),s=e.querySelector(".storecrm_login_required_login"),a=e.querySelector(".storecrm_login_required_cancel");i&&(i.textContent=t.title),r&&(r.textContent=t.description),s&&(s.textContent=t.login),a&&(a.textContent=t.cancel);const l=this.getRestockLoginRequiredColorOption("login_required_modal_overlay_color","#000000"),c=this.getRestockLoginRequiredNumberOption("login_required_modal_overlay_opacity",55,0,90),d=this.getRestockLoginRequiredColorOption("login_required_modal_text_color","#111111"),u=this.getRestockLoginRequiredNumberOption("login_required_modal_width",576,320,720),h=this.getRestockLoginRequiredNumberOption("login_required_modal_radius",2,0,24),m=this.getRestockLoginRequiredNumberOption("login_required_modal_button_radius",32,0,40),p=this.getRestockLoginRequiredColorOption("login_required_modal_login_button_background_color","#000000"),g=this.getRestockLoginRequiredColorOption("login_required_modal_login_button_text_color","#ffffff"),f=this.getRestockLoginRequiredColorOption("login_required_modal_cancel_button_background_color","#ffffff"),_=this.getRestockLoginRequiredColorOption("login_required_modal_cancel_button_text_color","#111111"),v=this.getRestockLoginRequiredColorOption("login_required_modal_cancel_button_border_color","#111111");o&&(o.style.backgroundColor=this.toRgba(l,c/100)),n&&(n.style.backgroundColor=this.getRestockLoginRequiredColorOption("login_required_modal_background_color","#ffffff"),n.style.color=d,n.style.width=`${u}px`,n.style.maxWidth="100%",n.style.borderRadius=`${h}px`),i&&(i.style.color=d),r&&(r.style.color=d),s&&(s.style.backgroundColor=p,s.style.borderColor=p,s.style.color=g,s.style.borderRadius=`${m}px`),a&&(a.style.backgroundColor=f,a.style.borderColor=v,a.style.color=_,a.style.borderRadius=`${m}px`)}toRgba(e,t){const o=Math.min(1,Math.max(0,t)),n=e.trim(),i=n.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i),r=n.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);if(i){const[,e,t,n]=i;return`rgba(${parseInt(e+e,16)}, ${parseInt(t+t,16)}, ${parseInt(n+n,16)}, ${o})`}if(r){const[,e,t,n]=r;return`rgba(${parseInt(e,16)}, ${parseInt(t,16)}, ${parseInt(n,16)}, ${o})`}return`rgba(0, 0, 0, ${o})`}isPendingRestockIntentExpired(e){return!e.created_at||Date.now()-e.created_at>v.PENDING_RESTOCK_INTENT_TTL_MS}isLoggedInCustomer(){return n(this,void 0,void 0,function*(){const e=(this.getCurrentShopifyCustomerId()||"").toString();if(!e)return!1;let t=(window.localStorage.getItem("storecrm_customer_id")||"").toString();if(!t||/^TEMP_/.test(t)||t!==e){try{yield this.fetchToken({syncWishlist:!1})}catch(e){console.warn("StoreCRM: failed to refresh token for restock login check",e)}t=(window.localStorage.getItem("storecrm_customer_id")||"").toString()}return!!t&&!/^TEMP_/.test(t)&&t===e})}isCurrentPageSameAsPendingPdp(e){try{const t=new URL(window.location.href,window.location.origin),o=new URL(e.pdp_url,window.location.origin);return t.origin===o.origin&&t.pathname===o.pathname&&("line"===e.channel&&(t.searchParams.delete("line_connect"),t.searchParams.delete("line_profile_data"),t.searchParams.delete("line_login_error")),t.search===o.search)}catch(e){return!1}}isAccountPage(){return-1!==this.getAccountPathIndex(window.location.pathname)}showPendingRestockPopup(e,t={}){this.popupManager.show(this.config.restockPopup,this.getPendingRestockVariants(e),e.product_id,t)}showPendingLineRestockPopup(e,t){this.lineRestockPopupManager.show(this.config.lineRestockPopup,this.getPendingRestockVariants(e),e.product_id,t,{buttonId:e.button_id,variantId:e.variant_id})}handlePendingRestockIntent(){return n(this,void 0,void 0,function*(){var e;if(this.pendingRestockIntentProcessing)return;const t=this.getPendingRestockIntent();if(t)if(this.isPendingRestockIntentExpired(t))this.clearPendingRestockIntent();else{this.pendingRestockIntentProcessing=!0;try{if(!(yield this.isLoggedInCustomer()))return void(this.isAccountPage()||this.schedulePendingRestockIntentRetry());if(!this.isCurrentPageSameAsPendingPdp(t))return void(window.location.href=t.pdp_url);if("line"===t.channel)return void(yield this.handlePendingLineRestockIntent(t));if(!t.auto_register_after_login)return void this.clearPendingRestockIntent();const o=null===(e=window.storecrm_data)||void 0===e?void 0:e.customer_email;if(this.clearPendingRestockIntent(),!o||!this.checkEmailFormat(o))return this.showPendingRestockPopup(t),void this.popupManager.failure("\u30ed\u30b0\u30a4\u30f3\u4e2d\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u518d\u5165\u8377\u901a\u77e5\u30dc\u30bf\u30f3\u304b\u3089\u3082\u3046\u4e00\u5ea6\u767b\u9332\u3057\u3066\u304f\u3060\u3055\u3044\u3002");yield this.doStoreRestock(t.variant_id,t.product_id,o,!1,!1,!1,t.mode),this.shouldShowRestockRegisteredState()?(this.markRestockStatusCacheRegistered("email",t.product_id,t.variant_id,t.mode),t.button_id&&this.applyRestockButtonRegisteredState("email",t.button_id,!0),this.refreshAllRestockButtonStates(!1)):this.invalidateRestockStatusCache(t.product_id,t.variant_id,t.mode),this.showPendingRestockPopup(t,{readOnly:!0,hideSubmitButton:!0,variantId:t.variant_id,email:o}),this.popupManager.success(this.config.restockPopup.success_text)}catch(e){if(this.clearPendingRestockIntent(),console.error("StoreCRM: pending restock auto registration failed",e),t){if("line"===t.channel)return this.showPendingLineRestockPopup(t),void this.lineRestockPopupManager.failure(this.config.lineRestockPopup.error_text);this.showPendingRestockPopup(t)}this.popupManager.failure(this.config.restockPopup.error_text)}finally{this.pendingRestockIntentProcessing=!1}}})}handlePendingLineRestockIntent(e){return n(this,void 0,void 0,function*(){var t,o;const n=this.hasLineConnectResultParams();n&&(this.pendingLineRestockConnectRedirectStarted=!1),this.removeLineConnectResultParamsFromUrl();const i=yield this.getRestockStatus(e.product_id,e.variant_id,e.mode,!0);if(null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.registered)return this.clearPendingRestockIntent(),this.removeLineConnectResultParamsFromUrl(!0),this.markRestockStatusCacheRegistered("line",e.product_id,e.variant_id,e.mode),e.button_id&&this.applyRestockButtonRegisteredState("line",e.button_id,!0),void this.refreshAllRestockButtonStates(!1);const r=yield this.tryGetLineProfile();if(!(null==r?void 0:r.line_customer_id)&&!(null===(o=null==i?void 0:i.line)||void 0===o?void 0:o.line_connected)){if(!n){if(e.line_connect_started_at)return this.clearPendingRestockIntent(),void this.showPendingLineRestockPopup(e,r);if(this.pendingLineRestockConnectRedirectStarted)return;this.pendingLineRestockConnectRedirectStarted=!0,this.setPendingRestockIntent(Object.assign(Object.assign({},e),{line_connect_started_at:Date.now()}));try{yield this.doLineSubscribe()}catch(e){throw this.pendingLineRestockConnectRedirectStarted=!1,e}return}return this.clearPendingRestockIntent(),this.removeLineConnectResultParamsFromUrl(!0),void this.showPendingLineRestockPopup(e,r)}if(this.clearPendingRestockIntent(),!e.auto_register_after_login)return this.removeLineConnectResultParamsFromUrl(!0),void this.showPendingLineRestockPopup(e,r);yield this.registerLineRestockOneClick(e.button_id,e.product_id,this.getPendingRestockVariants(e),e.variant_id,e.mode,r),this.removeLineConnectResultParamsFromUrl(!0)})}registerLineRestockOneClick(e,t,o,i,r,s){return n(this,void 0,void 0,function*(){const n=Boolean(null==s?void 0:s.line_customer_id)||Boolean(null==s?void 0:s.display_name)||Boolean(null==s?void 0:s.picture_url);yield this.doStoreLineRestock(t,i,(null==s?void 0:s.line_customer_id)||"",(null==s?void 0:s.display_name)||"",n?JSON.stringify(s):"",r),this.shouldShowRestockRegisteredState()?(this.markRestockStatusCacheRegistered("line",t,i,r),e&&this.applyRestockButtonRegisteredState("line",e,!0),this.refreshAllRestockButtonStates(!1)):this.invalidateRestockStatusCache(t,i,r),this.lineRestockPopupManager.show(this.config.lineRestockPopup,o,t,s,{readOnly:!0,hideSubmitButton:!0,variantId:i}),this.lineRestockPopupManager.success(this.config.lineRestockPopup.success_text)})}showLineRestockPopup(e){return n(this,void 0,void 0,function*(){var t,o,n;const i=l.LineRestockButton.getInstance(e);if(!i)return void console.error("StoreCRM LineRestock: lineRestockButton not found");const r=yield this.isLoggedInCustomer(),s=this.getCurrentRestockVariantId(i.variants),a=this.getRestockRegistrationMode(i.variants,s),c=this.buildPendingRestockIntent(e,i,"line");if(this.isRestockLoginRequired()&&!r)return void this.showRestockLoginRequiredModal(c);let d,u=!1,h=null;if(r){if((this.shouldShowRestockRegisteredState()||this.shouldOneClickRestockWhenLoggedIn()||this.shouldAutoRegisterRestockAfterLogin())&&(h=yield this.getRestockStatus(i.productId,s,a,!0)),this.shouldShowRestockRegisteredState()&&(null===(t=null==h?void 0:h.line)||void 0===t?void 0:t.registered))return void this.applyRestockButtonRegisteredState("line",e,!0);if(this.shouldOneClickRestockWhenLoggedIn()){const t=yield this.tryGetLineProfile();if(d=t,u=!0,(null==t?void 0:t.line_customer_id)||(null===(o=null==h?void 0:h.line)||void 0===o?void 0:o.line_connected))try{return void(yield this.registerLineRestockOneClick(e,i.productId,i.variants,s,a,t))}catch(o){return console.error("StoreCRM LineRestock: one-click registration failed",o),this.lineRestockPopupManager.show(this.config.lineRestockPopup,i.variants,i.productId,t,{buttonId:e,variantId:s}),void this.lineRestockPopupManager.failure(this.config.lineRestockPopup.error_text)}}}if(null===(n=window.storecrm_data)||void 0===n?void 0:n.customer_id){const t=u?d:yield this.tryGetLineProfile();this.lineRestockPopupManager.show(this.config.lineRestockPopup,i.variants,i.productId,t,{buttonId:e,variantId:s})}else this.lineRestockPopupManager.show(this.config.lineRestockPopup,i.variants,i.productId,void 0,{buttonId:e,variantId:s})})}startLineRestockConnectFromPopup(e){return n(this,arguments,void 0,function*(e,t=[],o={}){if(!e)throw new Error("StoreCRM LineRestock: productId is required");let n=window.location.href;try{n=this.getUrlWithoutLineConnectResultParams(window.location.href,!0)}catch(e){console.warn("StoreCRM LineRestock: failed to sanitize pending restock URL",e)}this.removeLineConnectResultParamsFromUrl(!0);const i=o.variantId||this.getCurrentRestockVariantId(t),r=this.getRestockRegistrationMode(t,i),s={version:1,channel:"line",product_id:e,variant_id:i,pdp_url:n,button_id:o.buttonId,clicked_at:(new Date).toISOString(),created_at:Date.now(),line_connect_started_at:Date.now(),auto_register_after_login:this.shouldOneClickRestockWhenLoggedIn(),mode:r};this.setPendingRestockIntent(s),this.pendingLineRestockConnectRedirectStarted=!0;try{yield this.doLineSubscribe()}catch(e){throw this.clearPendingRestockIntent(),e}})}tryGetLineProfile(){return n(this,void 0,void 0,function*(){try{return yield this.doGetLineProfile()}catch(e){return void console.warn("StoreCRM LineRestock: failed to get LINE profile",e)}})}storeRestock(e,t,o,n,i,r,s=void 0,a=void 0){if(!this.checkEmailFormat(e))return a&&a("\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002");const l=this.getRestockRegistrationMode([],t);this.doStoreRestock(t,o,e,i,n,r,l).then(()=>{this.invalidateRestockStatusCache(o,t,l),this.refreshAllRestockButtonStates(!0),s&&s(this.config.restockPopup.success_text)}).catch(e=>{console.error("StoreCRM: API call failed:",e),a&&a(this.config.restockPopup.error_text)})}doStoreRestock(e,t,o,i,r,s){return n(this,arguments,void 0,function*(e,t,o,n,i,r,s=this.favoriteMode){var a,l;if(n)try{const e=(null===(a=this.config.restockPopup)||void 0===a?void 0:a.create_shopify_customer)||!1,t=e&&(null===(l=this.config.restockPopup)||void 0===l?void 0:l.create_shopify_customer_tags)||void 0;yield this.doUpsertCustomerAcceptsMarketing(o,i,r,t,e)}catch(e){console.error("API call failed:",e)}return yield this.request("POST",`${this.config.backendUrl}/frontend/restock/`,{product_id:t,variant_id:e,email:o,mode:s})})}storeLineRestock(e,t,o,n,i,r=void 0,s=void 0){const a=this.getRestockRegistrationMode([],t);this.doStoreLineRestock(e,t,o,n,i,a).then(()=>{this.invalidateRestockStatusCache(e,t,a),this.refreshAllRestockButtonStates(!0),r&&r(this.config.lineRestockPopup.success_text)}).catch(e=>{console.error("StoreCRM: API call failed:",e),s&&s(this.config.lineRestockPopup.error_text)})}doStoreLineRestock(e,t,o,i,r){return n(this,arguments,void 0,function*(e,t,o,n,i,r=this.favoriteMode){return yield this.request("POST",`${this.config.backendUrl}/frontend/line/restock/`,{product_id:e,variant_id:t,line_customer_id:o,line_name:n,line_profile:i,mode:r})})}doUpsertCustomerAcceptsMarketing(e,t,o,i,r){return n(this,void 0,void 0,function*(){const n={email:e,accepts_marketing:t,new_customer:o,create_shopify_customer:r||!1};i&&(n.tags=i);return yield this.request("POST",`${this.config.backendUrl}/frontend/accepts-marketing/`,n)})}doGetLineProfile(){return n(this,void 0,void 0,function*(){return yield this.request("GET",`${this.config.backendUrl}/frontend/line/profile`)})}renderStatusWidget(){if(this.statusWidget)return;const e=document.querySelector(".storecrm-status-widget-target"),t=document.querySelector("#shopify-section-header,.section-header,.section--header,header,.header-wrapper,.header,.header_nav"),o=document.querySelector("#MainContent, #main, .main, main");if(t||o||e){if(e)this.statusWidget=new h.StatusWidget(e,"beforeend",this.config);else if(o)this.statusWidget=new h.StatusWidget(o,"afterbegin",this.config);else{if(!t)return;this.statusWidget=new h.StatusWidget(t,"beforeend",this.config)}this.statusWidget.setParent(this),this.statusWidget.render()}else console.error("Shopify header not found. Please assign following class/id/element to header: #shopify-section-header,.section-header,.section--header,header,.header_nav")}getStatus(e,t){this.doGetStatus().then(t=>{e(t)}).catch(e=>{console.error(e),t("\u30b5\u30fc\u30d0\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002")})}doGetStatus(){return n(this,void 0,void 0,function*(){return yield this.request("GET",`${this.config.backendUrl}/frontend/status`)})}lineSubscribe(e=void 0){this.doLineSubscribe()}doLineSubscribe(){return n(this,void 0,void 0,function*(){const e=yield this.getToken(),t=yield this.getCustomerId(),o=window.location.href,n=this.getShopDomainFromStoreCRMToken(e);location.href=`${this.config.backendUrl}/frontend/line/connect?token=${e}&customer_id=${t}&host=${n}&referrer=${encodeURIComponent(o)}`})}doLineLogin(){return n(this,void 0,void 0,function*(){const e=yield this.getCustomerId(),t=yield this.getToken(),o=window.location.href,n=this.getShopDomainFromStoreCRMToken(t);location.href=`${this.config.backendUrl}/frontend/line/connect?is_multipass=true&token=${t}&customer_id=${e}&host=${n}&referrer=${encodeURIComponent(o)}`})}lineUnsubscribe(e=void 0){this.doLineUnsubscribe().then(e=>{e&&"string"==typeof e.redirect_url&&e.redirect_url?location.href=e.redirect_url:location.href=location.pathname+"?line_disconnect=1"}).catch(t=>{console.error(t),e?e("LINE\u306e\u901a\u77e5\u89e3\u9664\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002"):alert("LINE\u306e\u901a\u77e5\u89e3\u9664\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002")})}doLineUnsubscribe(){return n(this,void 0,void 0,function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/line/disconnect`)})}mailSubscribe(){this.doMailSubscribe().then(e=>{console.log("StoreCRM: \u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u8cfc\u8aad\u306b\u6210\u529f\u3057\u307e\u3057\u305f\u3002",e);const t=document.getElementById("storecrm_message");t&&(t.innerHTML="\u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u8cfc\u8aad\u306b\u6210\u529f\u3057\u307e\u3057\u305f\u3002"),this.statusWidget&&this.statusWidget.render()}).catch(e=>{console.error(e),alert("\u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u8cfc\u8aad\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002")})}doMailSubscribe(){return n(this,void 0,void 0,function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/email/subscribe`)})}mailUnsubscribe(){this.doMailUnsubscribe().then(e=>{console.log("StoreCRM: \u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u89e3\u9664\u306b\u6210\u529f\u3057\u307e\u3057\u305f\u3002",e);const t=document.getElementById("storecrm_message");t&&(t.innerHTML="\u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u89e3\u9664\u306b\u6210\u529f\u3057\u307e\u3057\u305f\u3002"),this.statusWidget&&this.statusWidget.render()}).catch(e=>{console.error(e);const t=document.getElementById("storecrm_message");t&&(t.innerHTML="\u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u89e3\u9664\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002",e.toString().includes("401")&&(t.innerHTML+='
\u89e3\u9664\u3092\u9032\u3081\u308b\u306b\u306f\u30ed\u30b0\u30a4\u30f3\u3092\u3057\u3066\u304f\u3060\u3055\u3044\u3002')),alert("\u30e1\u30fc\u30eb\u30de\u30ac\u30b8\u30f3\u306e\u89e3\u9664\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002")})}doMailUnsubscribe(){return n(this,void 0,void 0,function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/email/unsubscribe`)})}doMailCheck(e){return n(this,arguments,void 0,function*(e,t=void 0){if(!this.checkEmailFormat(e))return t&&t("\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002");return yield this.request("GET",`${this.config.backendUrl}/frontend/accepts-marketing/?email=${encodeURIComponent(e)}`)})}birthdaySet(){}checkEmailFormat(e){return!(!e||!e.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/))}checkConnect(){const e=new URLSearchParams(window.location.search),t=e.get("storecrm"),o=window.localStorage.getItem("storecrm_customer_id");if(!o||o.startsWith("TEMP_")){const e=document.getElementById("storecrm_message");return void(e&&(e.innerHTML='\u8a2d\u5b9a\u5909\u66f4\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
\u9032\u3081\u308b\u306b\u306f\u30ed\u30b0\u30a4\u30f3\u3092\u3057\u3066\u304f\u3060\u3055\u3044\u3002'))}if(!this.checkConnectExecuted){if(this.checkConnectExecuted=!0,"line_connect"===t?this.lineSubscribe(function(){console.log("StoreCRM: LINE\u306e\u901a\u77e5\u767b\u9332\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002")}):"line_disconnect"===t?this.lineUnsubscribe():"email_subscribe"===t?this.mailSubscribe():"email_unsubscribe"===t?this.mailUnsubscribe():"birthday_set"===t&&this.birthdaySet(),e.get("line_disconnect")){const e=document.querySelector("#storecrm_message");e&&(e.innerHTML="LINE\u306e\u9023\u643a\u3092\u89e3\u9664\u3057\u307e\u3057\u305f\u3002")}if(e.get("line_connect")){const e=document.querySelector("#storecrm_message");e&&(e.innerHTML="LINE\u3092\u9023\u643a\u3057\u307e\u3057\u305f\u3002")}}}}v.PENDING_RESTOCK_INTENT_KEY="storecrm_pending_restock_intent",v.PENDING_RESTOCK_INTENT_TTL_MS=864e5,v.PENDING_RESTOCK_RETRY_LIMIT=120,v.RESTOCK_LOGIN_REQUIRED_MODAL_ID="storecrm-restock-login-required-modal",v.RESTOCK_LOADING_STYLE_ID="storecrm-restock-loading-style",v.LOCALE_PATTERN=/^[a-z]{2}(?:-[a-z0-9]{2,8})?$/i,v.DEFAULT_EXCLUDED_ACCOUNT_PAGES=[_.ExcludedAccountPage.LOGIN,_.ExcludedAccountPage.REGISTER,_.ExcludedAccountPage.RECOVER,_.ExcludedAccountPage.ACTIVATE,_.ExcludedAccountPage.RESET],t.default=v},811(e,t){t.containsShopifyId=t.Q=void 0;t.Q=e=>{if(null==e)return null;const t=String(e),o=t.match(/\/(\d+)$/);return o?o[1]:t};t.containsShopifyId=(e,o)=>{const n=(0,t.Q)(o);return!(!n||!Array.isArray(e))&&e.some(e=>(0,t.Q)(e)===n)}},250(e,t){t.isAppProxyPathname=t.buildAppProxyUrl=t.Fo=t._t=void 0;const o=/^\/(?:a|apps|community|tools)\/[A-Za-z0-9_-]{1,30}$/,n=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})?$/,i=new Set(["admin","services","password","login"]);t._t=e=>{let t=String(null!=e?e:"").trim().replace(/^https?:\/\/[^/]+/i,"").split(/[?#]/)[0].replace(/\/+$/,"");if(!t)return null;t=t.startsWith("/")?t:`/${t}`;const r=t.split("/").filter(Boolean);if(3===r.length&&n.test(r[0])&&(t=`/${r.slice(1).join("/")}`),!o.test(t))return null;const s=t.split("/")[2];return i.has(s.toLowerCase())?null:t};t.Fo=(e,o)=>{const n=(0,t._t)(e);if(n)return n;return`/apps/${String(null!=o?o:"obake").trim().replace(/^\/+|\/+$/g,"")||"obake"}`};t.buildAppProxyUrl=(e,o)=>{var n,i;const r=(0,t.Fo)(o.path,o.name),s=e.startsWith("/")?e:`/${e}`;return`${null!==(i=null===(n=o.origin)||void 0===n?void 0:n.replace(/\/$/,""))&&void 0!==i?i:""}${r}${s}`};t.isAppProxyPathname=(e,o,i)=>{const r=(0,t.Fo)(o,i),s=String(e||"").split("/").filter(Boolean);s.length>=3&&n.test(s[0])&&s.shift();const a=`/${s.join("/")}`;return a===r||a.startsWith(`${r}/`)}},449(e,t,o){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(o(664));window.storecrm=new i.default(window.storecrm_config||{}),window.storecrm.init()},308(e,t){var o;t.ExcludedAccountPage=void 0,function(e){e.LOGIN="login",e.REGISTER="register",e.RECOVER="recover",e.ACTIVATE="activate",e.RESET="reset"}(o||(t.ExcludedAccountPage=o={}))}};const t={};function o(n){const i=t[n];if(void 0!==i)return i.exports;const r=t[n]={id:n,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.exports}o.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{if(Array.isArray(t))for(var n=0;nObject.prototype.hasOwnProperty.call(e,t),o.r=e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nc=void 0;o(449)})();